|
11 | 11 | permissions: {} |
12 | 12 |
|
13 | 13 | jobs: |
| 14 | + build-base: |
| 15 | + name: Build base image |
| 16 | + runs-on: ubuntu-latest |
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + packages: write |
| 20 | + id-token: write |
| 21 | + steps: |
| 22 | + - name: Checkout code |
| 23 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 24 | + |
| 25 | + - name: Set up QEMU |
| 26 | + uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3 |
| 27 | + |
| 28 | + - name: Set up Docker Buildx |
| 29 | + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 |
| 30 | + |
| 31 | + - name: Log in to GitHub Container Registry |
| 32 | + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 |
| 33 | + with: |
| 34 | + registry: ghcr.io |
| 35 | + username: ${{ github.actor }} |
| 36 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + |
| 38 | + - name: Extract tag version |
| 39 | + id: tag |
| 40 | + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT |
| 41 | + |
| 42 | + - name: Set repository owner lowercase |
| 43 | + id: repo_owner |
| 44 | + env: |
| 45 | + REPO_OWNER: ${{ github.repository_owner }} |
| 46 | + run: echo "OWNER=$(echo "$REPO_OWNER" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT |
| 47 | + |
| 48 | + - name: Build and push base image |
| 49 | + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6 |
| 50 | + with: |
| 51 | + context: images/base |
| 52 | + platforms: linux/amd64,linux/arm64 |
| 53 | + push: true |
| 54 | + tags: | |
| 55 | + ghcr.io/${{ steps.repo_owner.outputs.OWNER }}/waggle/base:${{ steps.tag.outputs.VERSION }} |
| 56 | + ghcr.io/${{ steps.repo_owner.outputs.OWNER }}/waggle/base:latest |
| 57 | +
|
| 58 | + - name: Install Cosign |
| 59 | + uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0 |
| 60 | + |
| 61 | + - name: Sign base image with Cosign |
| 62 | + env: |
| 63 | + IMAGE: ghcr.io/${{ steps.repo_owner.outputs.OWNER }}/waggle/base |
| 64 | + TAG_VERSION: ${{ steps.tag.outputs.VERSION }} |
| 65 | + run: | |
| 66 | + cosign sign -y "$IMAGE:$TAG_VERSION" |
| 67 | + cosign sign -y "$IMAGE:latest" |
| 68 | +
|
14 | 69 | build-and-push: |
15 | 70 | name: Build ${{ matrix.image }} image |
| 71 | + needs: build-base |
16 | 72 | runs-on: ubuntu-latest |
17 | 73 | permissions: |
18 | 74 | contents: read |
|
0 commit comments