Skip to content

πŸ‘· PR #24 build - Align with Bookworm #29

πŸ‘· PR #24 build - Align with Bookworm

πŸ‘· PR #24 build - Align with Bookworm #29

name: HyperBian CI/Release Build
run-name: |
${{ github.event_name == 'push' && format('🌱 Push build - {0}', github.event.head_commit.message) || '' }}
${{ github.event_name == 'pull_request' && format('πŸ‘· PR #{0} build - {1}', github.event.pull_request.number, github.event.pull_request.title) || '' }}
${{ github.event_name == 'repository_dispatch' && 'πŸš€ Triggered HyperBian build' || '' }}
${{ github.event_name == 'workflow_dispatch' && 'πŸš€ Manual triggered HyperBian build' || '' }}
on:
push:
branches:
- '**'
pull_request:
branches:
- 'master'
workflow_dispatch:
repository_dispatch:
types: [ hyperion_push ]
env:
PLATFORM: bookworm
jobs:
image-builder:
name: "HyperBian (${{ matrix.pi-gen.architecture }})"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pi-gen: [
{ branch: master, architecture: armhf },
{ branch: arm64, architecture: arm64 }
]
steps:
- name: ⬇ Checkout HyperBian
uses: actions/checkout@v4
- name: ⬇ Checkout pi-gen
uses: actions/checkout@v4
with:
repository: RPi-Distro/pi-gen
ref: ${{ matrix.pi-gen.branch }}
path: pi-gen
- name: πŸ”§ Prepare
run: |
sudo apt-get update && sudo apt-get install -y coreutils quilt parted qemu-utils qemu-user-static debootstrap zerofree zip dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc kmod kpartx
echo "HYPERBIAN=HyperBian-${{ env.PLATFORM }}-${{ matrix.pi-gen.architecture }}" >> $GITHUB_ENV
- name: πŸ‘· Build
run: |
touch pi-gen/stage3/SKIP pi-gen/stage4/SKIP pi-gen/stage4/SKIP_IMAGES pi-gen/stage5/SKIP pi-gen/stage5/SKIP_IMAGES
cp -R stage-hyperbian pi-gen/
touch pi-gen/stage-hyperbian/EXPORT_IMAGE
cp config pi-gen/ && cd pi-gen
echo "Suites: ${{ env.PLATFORM }}" >> "./stage-hyperbian/00-install-hyperion/files/hyperion.sources"
echo "Architectures: ${{ matrix.pi-gen.architecture }}" >> "./stage-hyperbian/00-install-hyperion/files/hyperion.sources"
echo "RELEASE='${{ env.PLATFORM }}'" >> "./config"
sudo IMG_FILENAME=${{ env.HYPERBIAN }} ARCHIVE_FILENAME=${{ env.HYPERBIAN }} ./build.sh
- name: πŸ“¦ Upload
if: ${{ github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.HYPERBIAN }}
path: pi-gen/deploy/*.zip
retention-days: 1
#####################################
###### Publish GitHub Releases ######
#####################################
github_publish:
name: πŸš€ Publish GitHub Releases
if: ${{ github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' }}
needs: [ image-builder ]
runs-on: ubuntu-latest
steps:
- name: ⬇ Checkout HyperBian
uses: actions/checkout@v4
- name: πŸ”§ Prepare
id: read_template
shell: bash
run: |
TEMPLATE=$(cat ./.github/workflows/template.md)
TEMPLATE="${TEMPLATE//'%'/'%25'}"
TEMPLATE="${TEMPLATE//$'\n'/'%0A'}"
TEMPLATE="${TEMPLATE//$'\r'/'%0D'}"
echo "RELEASE_BODY=$TEMPLATE" >> "$GITHUB_OUTPUT"
- name: πŸ’Ύ Artifact download
uses: actions/[email protected]
with:
pattern: HyperBian-*
path: all-artifacts
merge-multiple: true
- name: Delete previous HyperBian Release
uses: dev-drprasad/[email protected]
with:
keep_latest: 0
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release and upload image
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: all-artifacts/*
tag: HyperBian
release_name: HyperBian
overwrite: true
body: |
${{ steps.read_template.outputs.RELEASE_BODY }}