Skip to content

Build

Build #271

Workflow file for this run

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_oldstable_lite_armhf_latest" -s -L -I -o /dev/null -w '%{url_effective}')")" >> $GITHUB_OUTPUT
echo "imageNeu=$(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 bullseye 32bit image
uses: actions/cache@v4
with:
path: ${{ steps.setup.outputs.image32 }}
key: ${{ steps.setup.outputs.image32 }}
- name: Cache Raspberry Pi OS bookworm 64bit image
uses: actions/cache@v4
with:
path: ${{ steps.setup.outputs.imageNeu }}
key: ${{ steps.setup.outputs.imageNeu }}
- name: Build storm.house images
id: build
run: |
sudo -E ./tests/ci-setup.bash github ${{ github.ref_name }}
sed -i -e "s|^userpw=.*$|userpw=\"${{secrets.USERPW}}\"|g" build-image/openhabian.conf
sed -i -e "s|ap_password:.*$|ap_password: ${{secrets.HOTSPOTPW}}|g" includes/comitup.conf
sudo -E ./build.bash rpi latest
mv openhabian-raspios32*.img.xz storm.house-$(date +%Y%m%d%H%M).img.xz
echo "image32=$(ls storm.house-*.img.xz)" >> $GITHUB_OUTPUT
sudo -E ./build.bash rpi64 latest
mv openhabian-raspios64*.img.xz storm.house-neu-$(date +%Y%m%d%H%M).img.xz
echo "imageNeu=$(ls storm.house-neu*.img.xz)" >> $GITHUB_OUTPUT
- name: Archive storm.house 32bit image
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.image32 }}
path: ${{ steps.build.outputs.image32 }}
- name: Archive storm.house 64bit bookworm image
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.imageNeu }}
path: ${{ steps.build.outputs.imageNeu }}
- name: Create release template
if: ${{ success() && github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: "openHABian ${{ github.ref_name }}"
automatic_release_tag: "${{ github.ref_name }}"
prerelease: false
draft: true
files: |
${{ steps.build.outputs.image32 }}
${{ steps.build.outputs.imageNeu }}