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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
name: Release
on:
workflow_dispatch:
permissions:
contents: write
jobs:
# ββ Read version from VERSION file ββββββββββββββββββββββββββββββββββββββββ
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Read version
id: version
run: echo "tag=v$(cat VERSION)" >> "$GITHUB_OUTPUT"
# ββ Build binaries for all platforms ββββββββββββββββββββββββββββββββββββββ
build:
name: Build Β· ${{ matrix.goos }}/${{ matrix.goarch }}
needs: prepare
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: |
BINARY="ev"
[ "${{ matrix.goos }}" = "windows" ] && BINARY="ev.exe"
go build \
-trimpath \
-ldflags="-s -w -X main.version=${{ needs.prepare.outputs.tag }}" \
-o "$BINARY" \
.
echo "BINARY=$BINARY" >> "$GITHUB_ENV"
- name: Package
run: |
if [ "${{ matrix.goos }}" = "windows" ]; then
ARCHIVE="ev_${{ matrix.goos }}_${{ matrix.goarch }}.zip"
zip "$ARCHIVE" "$BINARY" README.md
else
ARCHIVE="ev_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz"
tar czf "$ARCHIVE" "$BINARY" README.md
fi
echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ev_${{ matrix.goos }}_${{ matrix.goarch }}
path: ${{ env.ARCHIVE }}
if-no-files-found: error
# ββ Create GitHub release βββββββββββββββββββββββββββββββββββββββββββββββββ
release:
name: Release
needs: [prepare, build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Generate checksums
run: |
cd dist
sha256sum * > checksums.txt
echo ""
echo "ββ Artifacts ββββββββββββββββββββββββββ"
ls -lh
echo ""
echo "ββ Checksums ββββββββββββββββββββββββββ"
cat checksums.txt
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prepare.outputs.tag }}
files: dist/*
generate_release_notes: true
fail_on_unmatched_files: true
body: |
## Install
```bash
curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/install.sh | bash
```
Or download the binary for your platform below and place it in your `$PATH`.
## Checksums
See `checksums.txt` in the release assets.
|