Skip to content

Commit c6f370b

Browse files
authored
feat: apple signing and notary using quill (ekristen#64)
* chore: quill, sign darwin binaries * feat: support apple binary signing, a few minor chores
1 parent 0250dd2 commit c6f370b

File tree

4 files changed

+48
-28
lines changed

4 files changed

+48
-28
lines changed

.github/workflows/release.yml renamed to .github/workflows/goreleaser.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: goreleaser
33
on:
44
workflow_dispatch:
55
push:
6+
branches:
7+
- main
8+
- next
69
tags:
710
- "*"
811
release:
@@ -12,6 +15,7 @@ on:
1215
permissions:
1316
contents: write
1417
packages: write
18+
id-token: write
1519

1620
jobs:
1721
release:
@@ -43,14 +47,15 @@ jobs:
4347
username: ${{ github.actor }}
4448
password: ${{ secrets.GITHUB_TOKEN }}
4549
- name: install cosign
46-
uses: sigstore/cosign-installer@main
47-
with:
48-
cosign-release: "v2.0.1"
49-
- name: setup cosign
50-
run: |
51-
echo "${COSIGN_KEY}" > "$GITHUB_WORKSPACE/cosign.key"
50+
uses: sigstore/cosign-installer@v3
51+
- name: install quill
5252
env:
53-
COSIGN_KEY: ${{ secrets.COSIGN_KEY }}
53+
QUILL_VERSION: 0.4.1
54+
run: |
55+
curl -Lo /tmp/quill_${QUILL_VERSION}_linux_amd64.tar.gz https://github.com/anchore/quill/releases/download/v${QUILL_VERSION}/quill_${QUILL_VERSION}_linux_amd64.tar.gz
56+
tar -xvf /tmp/quill_${QUILL_VERSION}_linux_amd64.tar.gz -C /tmp
57+
mv /tmp/quill /usr/local/bin/quill
58+
chmod +x /usr/local/bin/quill
5459
- name: set goreleaser default args
5560
if: startsWith(github.ref, 'refs/tags/') == true
5661
run: |
@@ -63,6 +68,18 @@ jobs:
6368
if: startsWith(github.ref, 'refs/heads/renovate') == true
6469
run: |
6570
echo "GORELEASER_ARGS=--snapshot --skip-publish" >> $GITHUB_ENV
71+
- name: setup quill
72+
uses: 1password/load-secrets-action@v1
73+
if: startsWith(github.ref, 'refs/tags/') == true && github.actor == github.repository_owner
74+
with:
75+
export-env: true
76+
env:
77+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
78+
QUILL_NOTARY_KEY: ${{ secrets.OP_QUILL_NOTARY_KEY }}
79+
QUILL_NOTARY_KEY_ID: ${{ secrets.OP_QUILL_NOTARY_KEY_ID }}
80+
QUILL_NOTARY_ISSUER: ${{ secrets.OP_QUILL_NOTARY_ISSUER }}
81+
QUILL_SIGN_PASSWORD: ${{ secrets.OP_QUILL_SIGN_PASSWORD }}
82+
QUILL_SIGN_P12: ${{ secrets.OP_QUILL_SIGN_P12 }}
6683
- name: run goreleaser
6784
uses: goreleaser/goreleaser-action@v5
6885
with:
@@ -71,11 +88,10 @@ jobs:
7188
args: release --clean ${{ env.GORELEASER_ARGS }}
7289
env:
7390
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
7591
- name: push docker images (for branches)
7692
if: github.ref == 'refs/heads/main' || github.event.pull_request.base.ref == 'main'
7793
run: |
78-
docker images --format "{{.Repository}}:{{.Tag}}" | grep "ekristen/aws-nuke" | xargs -L1 docker push
94+
docker images --format "{{.Repository}}:{{.Tag}}" | grep "${{ github.repository }}" | xargs -L1 docker push
7995
- name: upload artifacts
8096
if: github.event.pull_request.base.ref == 'main'
8197
uses: actions/upload-artifact@v4

.github/workflows/semantic-lint.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: semantic-lint
22

33
on:
4-
pull_request:
5-
branches:
6-
- main
74
pull_request_target:
85
types:
96
- opened

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ cosign.key
55
/config*.yaml
66
/*-config.yaml
77
/config.*.yaml
8+
*.p12
9+
*.p8

.goreleaser.yml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ release:
33
github:
44
owner: ekristen
55
name: aws-nuke
6-
extra_files:
7-
- glob: ./cosign.pub
86
builds:
97
- id: default
108
env:
119
- CGO_ENABLED=0
1210
goos:
13-
- darwin
1411
- linux
1512
- windows
13+
- darwin
1614
goarch:
1715
- amd64
1816
- arm64
@@ -29,9 +27,11 @@ builds:
2927
ldflags:
3028
- -s
3129
- -w
32-
- -X '{{ .ModulePath }}/cmd.BuildVersion={{ .Version }}'
33-
- -X '{{ .ModulePath }}/cmd.BuildDate={{ .Date }}'
34-
- -X '{{ .ModulePath }}/cmd.BuildHash={{ .Commit }}'
30+
- -extldflags="-static"
31+
- -X '{{ .ModulePath }}/pkg/common.SUMMARY=v{{ .Version }}'
32+
- -X '{{ .ModulePath }}/pkg/common.BRANCH={{ .Branch }}'
33+
- -X '{{ .ModulePath }}/pkg/common.VERSION={{ .Tag }}'
34+
- -X '{{ .ModulePath }}/pkg/common.COMMIT={{ .Commit }}'
3535
archives:
3636
- id: default
3737
builds:
@@ -63,14 +63,14 @@ dockers:
6363
image_templates:
6464
- ghcr.io/ekristen/aws-nuke:v{{ .Version }}-arm64
6565
build_flag_templates:
66+
- "--platform=linux/arm64"
6667
- "--target=goreleaser"
6768
- "--pull"
6869
- "--label=org.opencontainers.image.created={{.Date}}"
6970
- "--label=org.opencontainers.image.title={{.ProjectName}}"
7071
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
7172
- "--label=org.opencontainers.image.version={{.Version}}"
72-
- "--label=org.opencontainers.image.source=https://github.com/ekristen/aws-nuke"
73-
- "--platform=linux/arm64"
73+
- '--label=org.opencontainers.image.source={{replace (replace (replace .GitURL "git@" "https://") ".git" "") "github.com:" "github.com/"}}'
7474
- use: buildx
7575
goos: linux
7676
goarch: arm
@@ -79,14 +79,14 @@ dockers:
7979
image_templates:
8080
- ghcr.io/ekristen/aws-nuke:v{{ .Version }}-arm32v7
8181
build_flag_templates:
82+
- "--platform=linux/arm/v7"
8283
- "--target=goreleaser"
8384
- "--pull"
8485
- "--label=org.opencontainers.image.created={{.Date}}"
8586
- "--label=org.opencontainers.image.title={{.ProjectName}}"
8687
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
8788
- "--label=org.opencontainers.image.version={{.Version}}"
88-
- "--label=org.opencontainers.image.source=https://github.com/ekristen/aws-nuke"
89-
- "--platform=linux/arm/v7"
89+
- '--label=org.opencontainers.image.source={{replace (replace (replace .GitURL "git@" "https://") ".git" "") "github.com:" "github.com/"}}'
9090
docker_manifests:
9191
- use: docker
9292
name_template: ghcr.io/ekristen/aws-nuke:v{{ .Version }}
@@ -95,14 +95,19 @@ docker_manifests:
9595
- ghcr.io/ekristen/aws-nuke:v{{ .Version }}-arm64
9696
- ghcr.io/ekristen/aws-nuke:v{{ .Version }}-arm32v7
9797
signs:
98-
- cmd: cosign
99-
stdin: "{{ .Env.COSIGN_PASSWORD }}"
100-
args:
101-
["sign-blob", "--yes", "--key=cosign.key", "--output=${signature}", "${artifact}"]
98+
- ids:
99+
- default
100+
cmd: cosign
101+
signature: "${artifact}.sig"
102+
certificate: "${artifact}.pem"
103+
args: ["sign-blob", "--yes", "--oidc-provider=github", "--oidc-issuer=https://token.actions.githubusercontent.com", "--output-certificate=${certificate}", "--output-signature=${signature}", "${artifact}"]
102104
artifacts: all
103105
docker_signs:
104-
- artifacts: all
105-
stdin: "{{ .Env.COSIGN_PASSWORD }}"
106+
- ids:
107+
- default
108+
artifacts: all
109+
cmd: cosign
110+
args: ["sign", "--yes", "--oidc-provider=github", "--oidc-issuer=https://token.actions.githubusercontent.com", "--output-certificate=${certificate}", "--output-signature=${signature}", "${artifact}"]
106111
checksum:
107112
name_template: "checksums.txt"
108113
snapshot:

0 commit comments

Comments
 (0)