-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (124 loc) · 4.33 KB
/
Copy pathrelease.yml
File metadata and controls
143 lines (124 loc) · 4.33 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install web deps
run: cd web && npm ci
- 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 ui-react
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: Sync Homebrew formula checksums
env:
VERSION: ${{ steps.ver.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
# Apply the formula update on top of the latest main (not the tag
# checkout) so the repo stays linear.
cp scripts/update-formula.sh /tmp/update-formula.sh
git fetch origin main
git checkout -B main origin/main
bash /tmp/update-formula.sh "$VERSION" "$PWD/dist"
if git diff --quiet -- Formula/slmcode.rb; then
echo "Formula unchanged — nothing to commit"
else
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Formula/slmcode.rb
git commit -m "chore: sync Homebrew formula checksums for v${VERSION} [skip ci]"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git push origin main
fi
- 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
irm https://raw.githubusercontent.com/UnicoLab/smlcode/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 }}