Use florid to pull packages temporarly #13
This file contains hidden or 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: Build & Push Docker image (GHCR) | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: [ "v*", "release-*" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository_owner }}/archlinuxarm-basic | |
| PLATFORMS: linux/arm64 | |
| DOCKERFILE: dockerfiles/Dockerfile.base | |
| TARGET: archarm | |
| jobs: | |
| build: | |
| name: Build${{ github.event_name == 'pull_request' && ' (no push)' || '' }} | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: docker-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU (for cross-compiling images) | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Derive image name | |
| id: img | |
| run: | | |
| echo "IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" >> $GITHUB_OUTPUT | |
| - name: Extract Docker metadata (tags, labels) | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ steps.img.outputs.IMAGE }} | |
| # Tag strategy: | |
| # - main branch -> :latest and :sha | |
| # - tags like v1.2.3 -> :1.2.3 and :1.2 and :1 | |
| # - PRs -> :pr-<num>-<sha> | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=ref,event=tag | |
| - name: Build (and push when not a PR) | |
| id: buildx | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ${{ env.DOCKERFILE }} | |
| target: ${{ env.TARGET }} | |
| platforms: ${{ env.PLATFORMS }} | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} # mirrors: -t $(IMAGE):minimal-aarch64 (+ semver / sha variants) | |
| labels: ${{ steps.meta.outputs.labels }} | |
| # Your local command used --load; in CI we push instead. (--load is single-arch only and not suited for multi-arch CI.) | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: false | |
| sbom: false |