Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
ci: add gpg signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Apr 2, 2023
1 parent 75844ae commit 60c5480
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: List keys
run: gpg -K

- uses: actions/checkout@v3

- name: Install Go
Expand Down Expand Up @@ -69,6 +78,9 @@ jobs:
- name: Checksums
run: ./checksums.sh

- name: Sign
run: ./sign.sh

- name: Release notes
run: go run ./cmd/release > _out/release.md

Expand All @@ -79,6 +91,9 @@ jobs:
body_path: _out/release.md
files: |
_out/go-linux-riscv64-bootstrap.tbz
_out/go-linux-riscv64-bootstrap.tbz.asc
_out/checksums.sha256.txt
_out/checksums.sha256.txt.asc
_out/go${{ env.GOVERSION }}.linux-riscv64.tar.gz
_out/go${{ env.GOVERSION }}.linux-riscv64.tar.gz.asc
_out/go${{ env.GOVERSION }}.src.tar.gz
17 changes: 17 additions & 0 deletions cmd/release/RELEASE.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,20 @@ You can check it without creating new shell session:
source /etc/profile.d/go.sh
go version
```

#### Verify signature

Import the public key:
```bash
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys '943040B9817AC4C7'
```

Download the signature:
```bash
wget "{{ .Archive.URL }}.sig"
```

Verify the signature:
```bash
gpg --batch --verify {{ .Archive.Name }}.sig {{ .Archive.Name }}
```
17 changes: 17 additions & 0 deletions sign.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e
set -o pipefail

ver="${GOVERSION:-1.20.2}"
archive="go${ver}.linux-riscv64.tar.gz"
bootstrap=go-linux-riscv64-bootstrap.tbz
src=go${ver}.src.tar.gz
sums=checksums.sha256.txt
key=943040B9817AC4C7

cd _out
for file in "${archive}" "${bootstrap}" "${src}" "${sums}"; do
gpg --batch --yes --default-key "${key}" --output "${file}.asc" --armor --detach-sig "${file}"
gpg --batch --default-key "${key}" --verify "${file}.asc" "${file}"
done

0 comments on commit 60c5480

Please sign in to comment.