image-mapper: map images in Dockerfiles (#257) #133
This file contains hidden or 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-push | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| # permission can be added at job level or workflows level | |
| permissions: | |
| id-token: write # This is required for requesting the JWT | |
| contents: read # This is required for actions/checkout | |
| packages: write # push to GHCR | |
| jobs: | |
| build: | |
| name: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| image: | |
| - aws-auth | |
| - github-issue-opener | |
| - image-copy-ecr | |
| - image-copy-gcp | |
| - image-diff | |
| - jira-issue-opener | |
| - slack-webhook | |
| - tag-history | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
| with: | |
| go-version-file: ${{ matrix.image }}/go.mod | |
| - uses: sigstore/cosign-installer@4959ce089c160fddf62f7b42464195ba1a56d382 # v3.0.2 | |
| - uses: ko-build/setup-ko@3aebd0597dc1e9d1a26bcfdb7cbeb19c131d3037 # v0.7 | |
| - env: | |
| KO_DOCKER_REPO: ghcr.io/chainguard-dev/${{matrix.image}} | |
| COSIGN_YES: true | |
| working-directory: ${{ matrix.image }} | |
| run: | | |
| ko build --image-refs=ko.images --bare . | |
| echo "ko build $(cat ko.images)" | |
| echo "Signing $(cat ko.images)" | |
| cosign sign "$(cat ko.images)" | |
| cosign download sbom "$(cat ko.images)" --output-file bom.spdx.json | |
| cosign attest --timeout=0 --type spdxjson --predicate bom.spdx.json "$(cat ko.images)" | |
| cosign verify-attestation --type spdxjson \ | |
| --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \ | |
| --certificate-identity "https://github.com/chainguard-dev/platform-examples/.github/workflows/build-push.yaml@refs/heads/main" \ | |
| "$(cat ko.images)" |