|
| 1 | +name: Build bootc images |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 4 * * *" # every day at 4am UTC |
| 6 | + workflow_dispatch: |
| 7 | + push: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + permissions: |
| 12 | + contents: read |
| 13 | + packages: write |
| 14 | + id-token: write |
| 15 | + strategy: |
| 16 | + fail-fast: true |
| 17 | + matrix: |
| 18 | + arch: [x86_64, aarch64] |
| 19 | + variant: |
| 20 | + - name: nothing |
| 21 | + image: ghcr.io/ultramarine-linux/shade/nothing:${{ github.ref_name || 'main' }} |
| 22 | + - name: cinnamon |
| 23 | + image: ghcr.io/ultramarine-linux/shade/cinnamon:${{ github.ref_name || 'main' }} |
| 24 | + - name: sway |
| 25 | + image: ghcr.io/ultramarine-linux/shade/sway:${{ github.ref_name || 'main' }} |
| 26 | + |
| 27 | + runs-on: ${{ contains(matrix.arch, 'aarch64') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} |
| 28 | + |
| 29 | + env: |
| 30 | + # set build platform for OCI |
| 31 | + BUILD_PLATFORM: ${{ contains(matrix.arch, 'aarch64') && 'linux/arm64' || 'linux/amd64' }} |
| 32 | + IMAGE_TAG: "${{ matrix.variant.image }}-${{ matrix.arch }}" |
| 33 | + BUILD_CONTEXT: "shades/${{ matrix.variant.name }}" |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 37 | + |
| 38 | + - name: Login to GitHub Container Registry |
| 39 | + # if: github.event_name != 'pull_request' |
| 40 | + env: |
| 41 | + registry: ghcr.io |
| 42 | + username: ${{ github.actor }} |
| 43 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + run: | |
| 45 | + echo ${{ secrets.GITHUB_TOKEN }} | sudo podman login -u ${{ github.actor }} --password-stdin $registry |
| 46 | + echo ${{ secrets.GITHUB_TOKEN }} | docker login -u ${{ github.actor }} --password-stdin $registry |
| 47 | +
|
| 48 | + - name: Build and push architecture images |
| 49 | + run: | |
| 50 | + podman build \ |
| 51 | + --platform "$BUILD_PLATFORM" \ |
| 52 | + --layers=true \ |
| 53 | + -f "${BUILD_CONTEXT}/Containerfile" \ |
| 54 | + -t "$IMAGE_TAG" "$BUILD_CONTEXT" |
| 55 | +
|
| 56 | + - name: Get digest |
| 57 | + run: | |
| 58 | + DIGEST=$(podman inspect --format '{{.Digest}}' "$IMAGE_TAG") |
| 59 | + echo "digest=$DIGEST" >> $GITHUB_OUTPUT |
| 60 | +
|
| 61 | + - name: Push to GHCR |
| 62 | + # if: github.event_name != 'pull_request' |
| 63 | + id: push |
| 64 | + run: | |
| 65 | + podman push "$IMAGE_TAG" |
| 66 | +
|
| 67 | + - name: Upload matrix outputs |
| 68 | + uses: cloudposse/github-action-matrix-outputs-write@v1 |
| 69 | + id: out |
| 70 | + with: |
| 71 | + matrix-step-name: ${{ github.job }} |
| 72 | + matrix-key: ${{ matrix.variant.name }} |
| 73 | + outputs: |- |
| 74 | + digest: ${{ steps.push.outputs.digest }} |
| 75 | + image: ${{ env.IMAGE_TAG }} |
| 76 | + manifest: "${{ needs.manifest.outputs.manifest }}" |
| 77 | + manifest: |
| 78 | + runs-on: ubuntu-latest |
| 79 | + if: "!cancelled()" |
| 80 | + permissions: |
| 81 | + contents: read |
| 82 | + packages: write |
| 83 | + id-token: write |
| 84 | + needs: |
| 85 | + - build |
| 86 | + |
| 87 | + steps: |
| 88 | + - uses: cloudposse/github-action-matrix-outputs-read@33cac12fa9282a7230a418d859b93fdbc4f27b5a |
| 89 | + id: read |
| 90 | + with: |
| 91 | + matrix-step-name: build |
| 92 | + |
| 93 | + - name: Debug outputs |
| 94 | + run: echo '${{ steps.read.outputs.result }}' |
| 95 | + |
| 96 | + - name: Image Metadata |
| 97 | + uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5 |
| 98 | + id: metadata |
| 99 | + with: |
| 100 | + tags: | |
| 101 | + type=ref,event=branch |
| 102 | + type=ref,event=tag |
| 103 | + type=sha |
0 commit comments