Skip to content

Commit

Permalink
Readme updates (#29)
Browse files Browse the repository at this point in the history
Readme updates

* remove redundant defaults from build step
* use docker_meta to generate tags+labels
* store the key and passphrase in a secret
* use github oidc for signing

Signed-off-by: Chris Nesbitt-Smith <chris@cns.me.uk>
  • Loading branch information
chrisns committed Oct 27, 2021
1 parent f700e6f commit 57790db
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions README.md
Expand Up @@ -96,6 +96,7 @@ jobs:
repository-projects: none
security-events: none
statuses: none
id-token: write # needed for signing the images with GitHub OIDC **not production ready**

name: Install Cosign and test presence in path
steps:
Expand All @@ -111,19 +112,34 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- id: docker_meta
uses: docker/metadata-action@v3.6.0
with:
images: ghcr.io/sigstore/sample-honk
tags: type=sha,format=long

- name: Build and Push container images
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
ghcr.io/sigstore/sample-honk:${{ github.sha }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

- name: Sign image
- name: Sign image with a key
run: |
cosign sign -key my_cosign.key ghcr.io/sigstore/sample-honk:${{ github.sha }}
echo ${COSIGN_KEY} > /tmp/my_cosign.key && \
cosign sign -key /tmp/my_cosign.key ${TAGS}
env:
TAGS: ${{ steps.docker_meta.outputs.tags }}
COSIGN_KEY: ${{secrets.COSIGN_KEY}}
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}

- name: Sign the images with GitHub OIDC **not production ready**
run: cosign sign -oidc-issuer https://token.actions.githubusercontent.com ${TAGS}
env:
TAGS: ${{ steps.docker_meta.outputs.tags }}
COSIGN_EXPERIMENTAL: 1
```

### Optional Inputs
Expand Down

0 comments on commit 57790db

Please sign in to comment.