test workflow #4
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: Build with SLSA | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- updates-docs | ||
env: | ||
IMAGE_REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
outputs: | ||
image: ${{ steps.image.outputs.image }} | ||
digest: ${{ steps.build.outputs.digest }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Authenticate Docker | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.IMAGE_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push Docker image | ||
id: build | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
labels: | | ||
org.opencontainers.image.source=${{ github.repositoryUrl }} | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
generate: | ||
needs: [ build ] | ||
permissions: | ||
actions: read | ||
id-token: write | ||
packages: write | ||
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2 | ||
Check failure on line 52 in .github/workflows/slsa.yml GitHub Actions / .github/workflows/slsa.ymlInvalid workflow file
|
||
with: | ||
image: ${{ needs.build.outputs.image }} | ||
digest: ${{ needs.build.outputs.digest }} | ||
registry-username: ${{ github.actor }} | ||
secrets: | ||
registry-password: ${{ secrets.GITHUB_TOKEN }} | ||
verify: | ||
needs: [ generate ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Cosign | ||
uses: sigstore/cosign-installer@v3 | ||
with: | ||
cosign-release: 'v2.1.1' | ||
- name: Verify SLSA Provenance | ||
run: | | ||
cosign verify-attestation ghcr.io/ianlewis/actions-test:latest |