Skip to content

🌱 Push build - Update release workflow #61

🌱 Push build - Update release workflow

🌱 Push build - Update release workflow #61

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-24.04-arm
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 arch-test
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: πŸ“‘ Read HyperBian template
uses: markpatterson27/markdown-to-output@v1
id: hyperbian_template
with:
filepath: ./.github/workflows/template.md
- name: πŸ’Ύ Artifact download
uses: actions/download-artifact@v4
with:
pattern: HyperBian-*
merge-multiple: true
- name: πŸ“¦ Create release and upload image
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: HyperBian
name: 'HyperBian'
prerelease: false
body: ${{ steps.hyperbian_template.outputs.body }}
files: '*.zip'
- name: 🧹 Cleanup
uses: geekyeggo/delete-artifact@v5
with:
name: artifact-*
failOnError: false