Skip to content

Add cosign signatures to wasm components on ghcr #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/attest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: build-attested-component

on:
push:
branches: [cosign]

jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
packages: write
contents: read
attestations: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Attest
uses: actions/attest@v1
id: attest
with:
subject-name: ghcr.io/yoshuawuyts/rust-wasi-hello
# subject-digest: ${{ steps.push.outputs.digest }}
subject-digest: sha256:67940472ac167f1c79224ee645ba59ca54483d95c633f9e67a4d16719d1fa356
predicate-type: "https://in-toto.io/attestation/release/v0.1"
predicate: '{"purl":"pkg:oci/..."}'
push-to-registry: true
11 changes: 11 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,14 @@ jobs:

- name: Run publish script
run: bash scripts/publish.sh ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}

- name: Install Cosign
uses: sigstore/[email protected]

- name: Sign wasm component
run: |
image="ghcr.io/${{ github.actor }}/rust-wasi-hello:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
cosign sign --yes --key env://COSIGN_PRIVATE_KEY $image
env:
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/target
.bin
Loading