Repository navigation
103 lines (86 loc) · 3.7 KB
/
Copy pathrelease.yml
File metadata and controls
103 lines (86 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
build:
name: Build ${{ matrix.suffix }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { goos: linux, goarch: amd64, suffix: linux-amd64 }
- { goos: linux, goarch: arm64, suffix: linux-arm64 }
- { goos: darwin, goarch: amd64, suffix: darwin-amd64 }
- { goos: darwin, goarch: arm64, suffix: darwin-arm64 }
- { goos: windows, goarch: amd64, suffix: windows-amd64.exe }
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Check that the tag matches the version in cmd/hemmelig/main.go
run: |
VERSION="${GITHUB_REF_NAME#v}"
grep -q "^const version = \"${VERSION}\"$" cmd/hemmelig/main.go || {
echo "::error::cmd/hemmelig/main.go does not have version ${VERSION}"
exit 1
}
- name: Test
run: go test ./...
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
go build -trimpath -ldflags="-s -w" -o "hemmelig-${{ matrix.suffix }}" ./cmd/hemmelig
sha256sum "hemmelig-${{ matrix.suffix }}" > "hemmelig-${{ matrix.suffix }}.sha256"
- uses: actions/upload-artifact@v7
with:
name: hemmelig-${{ matrix.suffix }}
path: |
hemmelig-${{ matrix.suffix }}
hemmelig-${{ matrix.suffix }}.sha256
release:
name: Publish the release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
path: artifacts
- name: Collect the files and the checksums
run: |
mkdir release
find artifacts -type f -exec cp {} release/ \;
cd release
cat *.sha256 > checksums.txt
cat checksums.txt
- uses: softprops/action-gh-release@v3
with:
name: Hemmelig CLI ${{ github.ref_name }}
files: |
release/hemmelig-*
release/checksums.txt
body: |
Encrypted, self-destructing secrets from the command line. The CLI encrypts on your machine, so the server gets only ciphertext.
## Install
```bash
PLATFORM=linux-amd64 # or linux-arm64, darwin-amd64, darwin-arm64
curl -fL "https://github.com/HemmeligOrg/cli/releases/download/${{ github.ref_name }}/hemmelig-${PLATFORM}" -o hemmelig
chmod +x hemmelig
sudo mv hemmelig /usr/local/bin/
```
On Windows, download `hemmelig-windows-amd64.exe` and put it in a folder in your `PATH`.
## Verify
```bash
curl -fL "https://github.com/HemmeligOrg/cli/releases/download/${{ github.ref_name }}/checksums.txt" -o checksums.txt
sha256sum -c checksums.txt --ignore-missing
```
See the [guide](https://github.com/HemmeligOrg/cli/blob/main/docs/cli.md) for all commands.