Build #1020
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
# Trigger the workflow on push or pull request | |
on: | |
push: | |
paths: | |
- 'build.bash' | |
- 'build-image/openhabian-installer.service' | |
- 'build-image/first-boot.bash' | |
- 'includes/offline-image-modifications.bash' | |
- '.github/workflows/build-action.yml' | |
pull_request: | |
paths: | |
- 'build.bash' | |
- 'build-image/openhabian-installer.service' | |
- 'build-image/first-boot.bash' | |
- 'includes/offline-image-modifications.bash' | |
- '.github/workflows/build-action.yml' | |
workflow_dispatch: | |
inputs: | |
comments: | |
description: 'Build comments' | |
default: 'Build for testing purposes' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Setup environment | |
id: setup | |
run: | | |
sudo -E bash -c set | |
sudo apt-get update | |
sudo apt-get install --yes libarchive-zip-perl dos2unix systemd-container qemu-user-static qemu-utils | |
echo "image32=$(basename "$(curl "https://downloads.raspberrypi.org/raspios_lite_armhf_latest" -s -L -I -o /dev/null -w '%{url_effective}')")" >> $GITHUB_OUTPUT | |
echo "image64=$(basename "$(curl "https://downloads.raspberrypi.org/raspios_lite_arm64_latest" -s -L -I -o /dev/null -w '%{url_effective}')")" >> $GITHUB_OUTPUT | |
- name: Cache Raspberry Pi OS 32bit image | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.setup.outputs.image32 }} | |
key: ${{ steps.setup.outputs.image32 }} | |
- name: Cache Raspberry Pi OS 64bit image | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.setup.outputs.image64 }} | |
key: ${{ steps.setup.outputs.image64 }} | |
- name: Build openHABian images | |
id: build | |
run: | | |
sudo -E ./tests/ci-setup.bash github ${{ github.ref_name }} | |
for f in "openhabian.conf openhabian.pi-raspios32.conf openhabian.pi-raspios64.conf"; do | |
if [[ -f build-image/$f ]]; then | |
sed -i -e "s|^userpw=.*$|userpw=\"${{secrets.USERPW}}\"|g" build-image/$f | |
fi | |
done | |
sed -i -e "s|ap_password:.*$|ap_password: ${{secrets.HOTSPOTPW}}|g" includes/comitup.conf | |
cp build-image/template_rpi-imager-openhab.json rpi-imager-openhab.json | |
sudo -E ./build.bash rpi oldstable | |
sudo -E ./build.bash rpi latest | |
sudo -E ./build.bash rpi64 latest | |
echo "image32old=$(ls openhabian-raspios32-oldstable*.img.xz)" >> $GITHUB_OUTPUT | |
echo "image32=$(ls openhabian-raspios32-latest*.img.xz)" >> $GITHUB_OUTPUT | |
echo "image64=$(ls openhabian-raspios64-latest*.img.xz)" >> $GITHUB_OUTPUT | |
echo "json_image=$(ls rpi-imager-openhab.json)" >> $GITHUB_OUTPUT | |
- name: Archive openHABian 32bit bullseye image | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.build.outputs.image32old }} | |
path: ${{ steps.build.outputs.image32old }} | |
- name: Archive openHABian 32bit Debian 12 bookworm image | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.build.outputs.image32 }} | |
path: ${{ steps.build.outputs.image32 }} | |
- name: Archive openHABian 64bit Debian 12 bookworm image | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.build.outputs.image64 }} | |
path: ${{ steps.build.outputs.image64 }} | |
- name: Archive openHABian json of image download | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.build.outputs.json_image }} | |
path: ${{ steps.build.outputs.json_image }} | |
- name: Create release template | |
if: ${{ success() && github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }} | |
uses: "softprops/action-gh-release@v2" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: "openHABian ${{ github.ref_name }}" | |
prerelease: false | |
draft: true | |
files: | | |
${{ steps.build.outputs.image32old }} | |
${{ steps.build.outputs.image32 }} | |
${{ steps.build.outputs.image64 }} | |
${{ steps.build.outputs.json_image }} |