Skip to content

Add workflow dispatch for both packages #2

Add workflow dispatch for both packages

Add workflow dispatch for both packages #2

Workflow file for this run

name: systemd-boot
on:
push:
branches: [main]
paths:
- "systemd-boot/**"
- ".github/workflows/systemd-boot.yml"
pull_request:
paths:
- "systemd-boot/**"
- ".github/workflows/systemd-boot.yml"
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build:
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
include:
# amd64 and arm64 build natively on their own runners -- no
# QEMU emulation involved for either leg.
- arch: amd64
runs-on: ubuntu-latest
- arch: arm64
runs-on: ubuntu-24.04-arm
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Read package version
id: version
run: echo "value=$(cat systemd-boot/VERSION)" >> "$GITHUB_OUTPUT"
# Derived from the repo name (rather than hardcoded) so the image
# path stays correct if the repo is ever renamed or moved. GHCR
# requires a lowercase path; github.repository preserves the
# repo's actual casing.
- name: Set image name
id: image
run: |
name="ghcr.io/${{ github.repository }}/systemd-boot"
echo "name=$(echo "$name" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
# Only this one explicit <version>-<arch> tag is ever pushed --
# deliberately not using docker/metadata-action's default tags
# (`main`, `sha-<sha>`), since those aren't arch-qualified and
# would overwrite each other between the amd64 and arm64 jobs.
- name: Build and push
uses: docker/build-push-action@v7
with:
context: systemd-boot
platforms: linux/${{ matrix.arch }}
push: ${{ github.event_name != 'pull_request' }}
build-args: SYSTEMD_VERSION=${{ steps.version.outputs.value }}
tags: ${{ steps.image.outputs.name }}:${{ steps.version.outputs.value }}-${{ matrix.arch }}