Skip to content

Commit

Permalink
feat: add sbom and keyless signing (#69)
Browse files Browse the repository at this point in the history
Signed-off-by: Engin Diri <engin.diri@mail.schwarz>
  • Loading branch information
Engin Diri authored Dec 24, 2021
1 parent c54d6af commit 77a962b
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 40 deletions.
26 changes: 21 additions & 5 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
{
"extends": [
"config:base",
":semanticCommitTypeAll(chore)"
":semanticCommits",
":semanticCommitTypeAll(chore)",
":gitSignOff"
],
"postUpdateOptions": [
"gomodTidy"
"gomodTidy",
"gomodUpdateImportPaths"
],
"commitBody": "Signed-off-by: {{{gitAuthor}}}",
"dependencyDashboard": false,
"labels": [
"dependencies"
],
"semanticCommits": "enabled"
}
"packageRules": [
{
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest"
]
}
],
"assigneesFromCodeOwners": true,
"assignAutomerge": true,
"automerge": true,
"automergeStrategy": "squash",
"automergeType": "pr"
}
19 changes: 8 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
- '*'
pull_request:

permissions:
contents: write
id-token: write
packages: write

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -29,7 +34,6 @@ jobs:
if: success() && startsWith(github.ref, 'refs/tags/')
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
COSIGN_KEY_LOCATION: "/tmp/cosign.key"
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -47,19 +51,12 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.17
- uses: sigstore/cosign-installer@main
with:
cosign-release: 'v1.2.0'
- name: install cosign private key
run: 'echo "$COSIGN_KEY" > $COSIGN_KEY_LOCATION'
shell: bash
env:
COSIGN_KEY: ${{secrets.COSIGN_KEY}}
- uses: sigstore/cosign-installer@v1.4.1
- uses: anchore/sbom-action/download-syft@v0.6.0
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 28 additions & 9 deletions .goreleaser.yml → .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,39 @@ dockers:
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/dirien/{{ .ProjectName }}

source:
enabled: true

sboms:
- artifacts: archive
- id: source
artifacts: source

checksum:
name_template: 'checksums.txt'

signs:
- cmd: cosign
stdin: '{{ .Env.COSIGN_PASSWORD }}'
args: ["sign-blob", "-key=cosign.key", "-output=${signature}", "${artifact}"]
env:
- COSIGN_EXPERIMENTAL=1
certificate: '${artifact}.pem'
args:
- sign-blob
- '--output-certificate=${certificate}'
- '--output-signature=${signature}'
- '${artifact}'
artifacts: checksum
output: true

docker_signs:
- artifacts: all
args: [ "sign", "-key=cosign.key", "${artifact}" ]
stdin: '{{ .Env.COSIGN_PASSWORD }}'

release:
extra_files:
- glob: ./cosign.pub
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
artifacts: manifests
output: true
args:
- 'sign'
- '${artifact}'

changelog:
sort: asc
Expand Down
11 changes: 0 additions & 11 deletions cosign.key

This file was deleted.

4 changes: 0 additions & 4 deletions cosign.pub

This file was deleted.

0 comments on commit 77a962b

Please sign in to comment.