Update quay.io/konflux-ci/tekton-catalog/task-buildah-remote:0.2 Dock… #848
This file contains 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: release | |
on: | |
push: | |
branches: | |
- main | |
env: | |
IMAGE_REGISTRY: ghcr.io | |
IMAGE_REPO: ${{ github.repository_owner }}/golden-container | |
IMAGE_TAGS: ${{ github.sha }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
# Needed for signing the container image with GitHub OIDC Token | |
id-token: write | |
# Needed to push to ghcr.io registry | |
packages: write | |
outputs: | |
image: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }} | |
digest: ${{ steps.push-image.outputs.digest }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Install Cosign | |
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0 | |
- name: Install Syft | |
uses: anchore/sbom-action/download-syft@fc46e51fd3cb168ffb36c6d1915723c47db58abb # v0.17.7 | |
- name: Log in to ghcr | |
uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Buildah Action | |
id: build-image | |
uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2 | |
with: | |
image: ${{ env.IMAGE_REPO }} | |
tags: ${{ env.IMAGE_TAGS }} | |
dockerfiles: ./Containerfile | |
- name: Push to ghcr | |
id: push-image | |
uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY }} | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
- name: Sign image with GitHub OIDC Token | |
run: cosign sign --yes ${IMAGE_REGISTRY}/${IMAGE_REPO}@${DIGEST} | |
env: | |
DIGEST: ${{ steps.push-image.outputs.digest }} | |
- name: Generate and store SBOM | |
run: | | |
syft "${IMAGE_REGISTRY}/${IMAGE_REPO}@${DIGEST}" -o spdx-json=sbom-spdx.json | |
cosign attest --yes --predicate sbom-spdx.json --type spdx "${IMAGE_REGISTRY}/${IMAGE_REPO}@${DIGEST}" | |
env: | |
DIGEST: ${{ steps.push-image.outputs.digest }} | |
provenance: | |
needs: [build] | |
permissions: | |
actions: read # for detecting the Github Actions environment. | |
id-token: write # for creating OIDC tokens for signing. | |
packages: write # for uploading attestations. | |
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | |
with: | |
image: ${{ needs.build.outputs.image }} | |
digest: ${{ needs.build.outputs.digest }} | |
registry-username: ${{ github.actor }} | |
secrets: | |
registry-password: ${{ secrets.GITHUB_TOKEN }} | |
validate: | |
needs: [provenance, build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Validate image | |
uses: enterprise-contract/[email protected] | |
with: | |
image: ${{ needs.build.outputs.image }}@${{ needs.build.outputs.digest }} | |
identity: https:\/\/github\.com\/(slsa-framework\/slsa-github-generator|${{ github.repository_owner }}\/${{ github.event.repository.name }})\/ | |
issuer: https://token.actions.githubusercontent.com | |
promote: | |
runs-on: ubuntu-latest | |
needs: [validate, build] | |
steps: | |
- name: Push latest-validated image tag | |
run: | | |
skopeo copy \ | |
--dest-creds=${{ github.actor }}:${{ github.token }} \ | |
docker://${{ needs.build.outputs.image }}@${{ needs.build.outputs.digest }} \ | |
docker://${{ needs.build.outputs.image }}:latest | |