Skip to content

Commit

Permalink
Use cosign for artifact verification
Browse files Browse the repository at this point in the history
  • Loading branch information
yankeexe committed Feb 6, 2022
1 parent 2791943 commit 19abc2c
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 9 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ permissions:
jobs:
goreleaser:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -19,7 +23,9 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17

- uses: sigstore/[email protected]
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
26 changes: 18 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
project_name: air
before:
hooks:
- go mod tidy
- go generate ./...
builds:
- ldflags:
- -s -w -X "github.com/yankeexe/air-quality-cli/cmd.Version={{.Tag}}"
binary: air
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
- format: binary

checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
name_template: "{{ .Tag }}-local"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

signs:
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
certificate: '${artifact}.pem'
output: true
artifacts: checksum
args:
- sign-blob
- '--output-certificate=${certificate}'
- '--output-signature=${signature}'
- '${artifact}'
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@ Get Air Quality index for your City.
curl -f https://raw.githubusercontent.com/yankeexe/air-quality-cli/master/install.sh | sudo sh
```

### Manual Installation
Download the [latest release](https://github.com/yankeexe/air-quality-cli/releases).


### Verification of artifacts

All artifacts are checksummed and the checksum file is signed with [cosign](https://github.com/sigstore/cosign#installation) (keyless).

* Download checksum and sig file for verification.

```bash
wget https://github.com/yankeexe/air-quality-cli/releases/download/v0.0.6/checksums.txt

wget https://github.com/yankeexe/air-quality-cli/releases/download/v0.0.6/checksums.txt.sig
```
* Verify the signature

```bash
COSIGN_EXPERIMENTAL=1 cosign verify-blob --signature checksums.txt.sig checksums.txt
```
If the signature is valid, verify the SHA256 match with the downloaded binary.

* Verify Downloaded Binary

Store downloaded binary on the same dir as `checksums.txt`
```bash
sha256sum --ignore-missing -c checksums.txt
```


<img src="https://i.imgur.com/FsnXPXw.png" width="800" />

## Contents
Expand Down

0 comments on commit 19abc2c

Please sign in to comment.