Skip to content

Commit

Permalink
ci: sign releases with gpg (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
lindell authored Nov 4, 2023
1 parent 9b5774a commit 84d4145
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ jobs:
go-version-file: "go.mod"
if: ${{ steps.release.outputs.release_created }}

- name: Import GPG key for signing
id: gpg
run: |
echo "${GPG_PRIVATE_KEY}" | gpg --import
fingerprint=$(echo "${GPG_PRIVATE_KEY}" | gpg --show-keys --with-colons | awk -F ":" '$1=="fpr" {print $10}')
echo "fingerprint=$fingerprint" >> $GITHUB_OUTPUT
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
Expand All @@ -42,6 +50,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GENERAL_GITHUB_SECRET }} # The tokens needs access to another repo, so the secret.GITHUB_SECRET won't suffice
FURY_TOKEN: ${{ secrets.FURY_TOKEN }} # Gemfury token
GPG_FINGERPRINT: ${{ steps.gpg.outputs.fingerprint }} # Fingerprint of GPG signing key
if: ${{ steps.release.outputs.release_created }}

- name: Comment on prs and issues
Expand Down
3 changes: 3 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ publishers:
- packages
dir: "{{ dir .ArtifactPath }}"
cmd: curl -F package=@{{ .ArtifactName }} https://{{ .Env.FURY_TOKEN }}@push.fury.io/multi-gitter/
signs:
- artifacts: checksum
args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]

0 comments on commit 84d4145

Please sign in to comment.