* Bump dev channel after build Bump version on dev channel automatically when building a dev branch pre-release. Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
159 lines
7.0 KiB
YAML
159 lines
7.0 KiB
YAML
# Home Assistant Operating System release build workflow
|
|
|
|
name: Release build
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
validate_release:
|
|
name: Validate release
|
|
runs-on: [ "ubuntu-20.04" ]
|
|
outputs:
|
|
version: ${{ steps.version_check.outputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Validate version
|
|
id: version_check
|
|
run: |
|
|
major=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_MAJOR | cut -d'=' -f2)
|
|
build=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_BUILD | cut -d'=' -f2)
|
|
if [ "${major}.${build}" != "${{ github.event.release.tag_name }}" ]; then
|
|
echo "Version number in Buildroot metadata is does not match tag (${major}.${build} vs ${{ github.event.release.tag_name }})."
|
|
exit 1
|
|
fi
|
|
echo "::set-output name=version::${major}.${build}"
|
|
|
|
build:
|
|
name: Release build for ${{ matrix.board.name }}
|
|
needs: validate_release
|
|
strategy:
|
|
matrix:
|
|
board:
|
|
- {"name": "ova", "output": "ova", "runner": "x86-64-runner"}
|
|
- {"name": "intel_nuc", "output": "intel-nuc", "runner": "x86-64-runner"}
|
|
- {"name": "odroid_c2", "output": "odroid-c2", "runner": "aarch64-runner"}
|
|
- {"name": "odroid_c4", "output": "odroid-c4", "runner": "aarch64-runner"}
|
|
- {"name": "odroid_n2", "output": "odroid-n2", "runner": "aarch64-runner"}
|
|
- {"name": "odroid_xu4", "output": "odroid-xu4" , "runner": "aarch64-runner"}
|
|
- {"name": "rpi", "output": "rpi", "runner": "arm-runner"}
|
|
- {"name": "rpi0_w", "output": "rpi0-w", "runner": "arm-runner"}
|
|
- {"name": "rpi2", "output": "rpi2", "runner": "arm-runner"}
|
|
- {"name": "rpi3", "output": "rpi3", "runner": "arm-runner"}
|
|
- {"name": "rpi3_64", "output": "rpi3-64", "runner": "aarch64-runner"}
|
|
- {"name": "rpi4", "output": "rpi4", "runner": "arm-runner"}
|
|
- {"name": "rpi4_64", "output": "rpi4-64", "runner": "aarch64-runner"}
|
|
- {"name": "tinker", "output": "tinker", "runner": "arm-runner"}
|
|
runs-on: ${{ matrix.board.runner }}
|
|
|
|
steps:
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Build container
|
|
run: docker build -t haos-builder .
|
|
|
|
- name: 'Add release PKI certs'
|
|
env:
|
|
RAUC_CERTIFICATE: ${{ secrets.RAUC_CERTIFICATE }}
|
|
RAUC_PRIVATE_KEY: ${{ secrets.RAUC_PRIVATE_KEY }}
|
|
run: |
|
|
echo -e "-----BEGIN CERTIFICATE-----\n${RAUC_CERTIFICATE}\n-----END CERTIFICATE-----" > cert.pem
|
|
echo -e "-----BEGIN PRIVATE KEY-----\n${RAUC_PRIVATE_KEY}\n-----END PRIVATE KEY-----" > key.pem
|
|
|
|
- name: Build
|
|
run: |
|
|
BUILDER_UID="$(id -u)"
|
|
BUILDER_GID="$(id -g)"
|
|
docker run --rm --privileged -v "${GITHUB_WORKSPACE}:/build" \
|
|
-e BUILDER_UID="${BUILDER_UID}" -e BUILDER_GID="${BUILDER_GID}" \
|
|
-v "${{ matrix.board.runner }}-build-cache:/cache" \
|
|
haos-builder make ${{ matrix.board.name }}
|
|
|
|
- name: Upload disk image
|
|
if: ${{ matrix.board.name != 'ova' }}
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.img.gz
|
|
asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.img.gz
|
|
asset_content_type: application/gzip
|
|
|
|
- name: Upload rauc update
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.raucb
|
|
asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.raucb
|
|
asset_content_type: application/octet-stream
|
|
|
|
- name: Upload qcow2 image
|
|
if: ${{ matrix.board.name == 'ova' }}
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.qcow2.gz
|
|
asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.qcow2.gz
|
|
asset_content_type: application/gzip
|
|
|
|
- name: Upload vdi image
|
|
if: ${{ matrix.board.name == 'ova' }}
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vdi.gz
|
|
asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vdi.gz
|
|
asset_content_type: application/gzip
|
|
|
|
- name: Upload vhdx image
|
|
if: ${{ matrix.board.name == 'ova' }}
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vhdx.gz
|
|
asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vhdx.gz
|
|
asset_content_type: application/gzip
|
|
|
|
- name: Upload vmdk image
|
|
if: ${{ matrix.board.name == 'ova' }}
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vmdk.gz
|
|
asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vmdk.gz
|
|
asset_content_type: application/gzip
|
|
|
|
bump_version:
|
|
name: Bump dev version to ${{ needs.validate_release.outputs.version }}
|
|
needs: [ build, validate_release ]
|
|
runs-on: [ "ubuntu-20.04" ]
|
|
|
|
steps:
|
|
- name: Initialize git
|
|
uses: home-assistant/actions/helpers/git-init@master
|
|
with:
|
|
name: ${{ secrets.GIT_NAME }}
|
|
email: ${{ secrets.GIT_EMAIL }}
|
|
token: ${{ secrets.GIT_TOKEN }}
|
|
|
|
- name: Bump Home Assistant OS dev version
|
|
uses: home-assistant/actions/helpers/version-push@master
|
|
with:
|
|
key: "hassos[]"
|
|
key-description: "Home Assistant OS"
|
|
version: ${{ needs.validate_release.outputs.version }}
|
|
channel: "dev"
|