Merge pull request #80 from srobo/sr2025-updates #43
Workflow file for this run
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: Image build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '**' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build image | |
runs-on: ubuntu-latest | |
permissions: | |
# Needed for creating releases | |
contents: write | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install fdisk gdisk qemu-user-static libarchive-tools tar | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build image | |
run: | | |
chmod +x ./build-image.sh | |
./build-image.sh | |
- name: Get output name | |
id: git-desc | |
run: | | |
echo "git_desc=$(git describe --tags --always)" >> $GITHUB_ENV | |
echo "image_path=$(realpath ${{ github.workspace }}/*.img.xz)" >> $GITHUB_ENV | |
echo "image_name=$(basename ${{ github.workspace }}/*.img.xz)" >> $GITHUB_ENV | |
- name: Save image artifact | |
uses: actions/upload-artifact@v4 | |
if: github.ref_type != 'tag' | |
with: | |
name: image-${{ env.git_desc }} | |
path: | | |
${{ env.image_path }} | |
py-packages.txt | |
- name: Do release with image artifact | |
if: github.ref_type == 'tag' | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
allowUpdates: true | |
artifacts: | | |
${{ env.image_path }} | |
py-packages.txt | |
draft: true | |
generateReleaseNotes: true | |
omitBodyDuringUpdate: true | |
omitNameDuringUpdate: true | |
updateOnlyUnreleased: true |