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