-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (93 loc) · 3 KB
/
Copy pathrelease.yml
File metadata and controls
109 lines (93 loc) · 3 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
104
105
106
107
108
109
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
release:
name: Build & Publish
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Extract version
id: ver
run: |
TAG="${GITHUB_REF_NAME}"
VERSION="${TAG#v}"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Lint & test
run: |
make lint
make test
- name: Build release binaries
env:
VERSION: ${{ steps.ver.outputs.version }}
run: |
set -euo pipefail
mkdir -p dist
commit="$(git rev-parse --short HEAD)"
built="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
ldflags="-s -w -X main.Version=${VERSION} -X main.GitCommit=${commit} -X main.BuildTime=${built}"
build() {
local goos="$1" goarch="$2" ext="$3"
local out="dist/slmcode_${VERSION}_${goos}_${goarch}${ext}"
echo "Building ${out}"
GOOS="$goos" GOARCH="$goarch" CGO_ENABLED=0 \
go build -trimpath -ldflags "$ldflags" -o "$out" ./cmd/slmcode
chmod +x "$out" || true
}
build darwin amd64 ""
build darwin arm64 ""
build linux amd64 ""
build linux arm64 ""
build windows amd64 ".exe"
build windows arm64 ".exe"
cp scripts/install-remote.sh dist/install.sh
cp scripts/install.ps1 dist/install.ps1
cp scripts/install.cmd dist/install.cmd
(
cd dist
shasum -a 256 slmcode_* install.sh install.ps1 install.cmd > SHA256SUMS
)
ls -lah dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.ver.outputs.tag }}
name: SLMCode ${{ steps.ver.outputs.tag }}
generate_release_notes: true
body: |
## Install
**macOS / Linux / WSL**
```bash
curl -fsSL https://raw.githubusercontent.com/UnicoLab/slmcode/main/scripts/install-remote.sh | bash
```
**Windows (PowerShell)**
```powershell
iem https://raw.githubusercontent.com/UnicoLab/slmcode/main/scripts/install.ps1 | iex
```
**Homebrew**
```bash
brew install --formula https://raw.githubusercontent.com/UnicoLab/slmcode/main/Formula/slmcode.rb
```
Made with ♥ by [UnicoLab](https://unicolab.ai)
files: |
dist/slmcode_*
dist/install.sh
dist/install.ps1
dist/install.cmd
dist/SHA256SUMS
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}