# # Copyright 2025 The Sigstore Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. name: Release service builder container on: push: tags: - 'release/service-builder/v*' permissions: {} jobs: release: name: Release services container image runs-on: ubuntu-latest permissions: id-token: write # needed to sign build provenance contents: read packages: write # needed to upload to GitHub Packages attestations: write # needed to persist attestation env: TAG: ${{ github.ref_name }} REGISTRY: ghcr.io IMAGE_NO_TAG: ghcr.io/${{ github.repository }}-service-builder steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Calculate tag and image_ref run: | tag="${TAG#"release/service-builder/v"}" echo "IMAGE_REF=${IMAGE_NO_TAG}:$tag" >> $GITHUB_ENV - name: Log into ghcr.io uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 with: registry: ${{ env.REGISTRY }} username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build services container run: make services-image - name: Tag image run: docker tag protoc-services ${IMAGE_REF} - name: Push image run: docker push ${IMAGE_REF} - name: Get image digest run: | digest=$(docker inspect --format='{{index .RepoDigests 0}}' ${IMAGE_REF}) image_digest=$(echo $digest | cut -d"@" -f2) echo "IMAGE_DIGEST=$image_digest" >> "$GITHUB_ENV" - name: Generate artifact attestation uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0 with: subject-name: ${{ env.IMAGE_NO_TAG }} subject-digest: ${{ env.IMAGE_DIGEST }} push-to-registry: true