Bump docker/login-action from 2.1.0 to 3.0.0 (#123) #69
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: Publish | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "v*.*.*" | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
CONTAINER_TAR: "container.tar" | |
jobs: | |
paranoia-inception: | |
runs-on: ubuntu-latest | |
outputs: | |
image: ${{ steps.build-and-push.outputs.image }} | |
digest: ${{ steps.build-and-push.outputs.digest }} | |
permissions: | |
contents: read | |
packages: write | |
id-token: write # for creating OIDC tokens for signing. | |
steps: | |
- name: Log in to the Container registry | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Checkout code" | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Install the cosign tool except on PR | |
# https://github.com/sigstore/cosign-installer | |
- name: Install cosign | |
uses: sigstore/cosign-installer@871cdc754496eb3792209f6e81422fac01b793b4 #v3.0.3 | |
with: | |
cosign-release: 'v2.0.2' | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@2c0bd771b40637d97bf205cbccdd294a32112176 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=edge,branch=main | |
type=ref,event=tag | |
- name: Build and export to Docker | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
outputs: type=docker,dest=${{ env.CONTAINER_TAR }} | |
- name: "Run Paranoia container" | |
uses: ./ | |
with: | |
target_tar: file://${{ env.CONTAINER_TAR }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
id: build-and-push | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# Sign the resulting Docker image digest except on PRs. | |
# This will only write to the public Rekor transparency log when the Docker | |
# repository is public to avoid leaking data. If you would like to publish | |
# transparency data even for private images, pass --force to cosign below. | |
# https://github.com/sigstore/cosign | |
- name: Sign the published Docker image | |
# This step uses the identity token to provision an ephemeral certificate | |
# against the sigstore community Fulcio instance. | |
env: | |
TAGS: ${{ steps.meta.outputs.tags }} | |
DIGEST: ${{ steps.build-and-push.outputs.digest }} | |
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} | |
provenance-for-images: | |
needs: [paranoia-inception] | |
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: ghcr.io/${{ github.repository }} | |
# The image digest is used to prevent TOCTOU issues. | |
# This is an output of the docker/build-push-action | |
# See: https://github.com/slsa-framework/slsa-verifier#toctou-attacks | |
digest: ${{ needs.paranoia-inception.outputs.digest }} | |
registry-username: ${{ github.actor }} | |
secrets: | |
registry-password: ${{ secrets.GITHUB_TOKEN }} |