-
Notifications
You must be signed in to change notification settings - Fork 3
204 lines (175 loc) · 7.56 KB
/
Copy pathdev-release.yml
File metadata and controls
204 lines (175 loc) · 7.56 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Dev Release
on:
push:
branches:
- main
workflow_dispatch:
# The dev channel is a single rolling release that tracks the tip of main.
# Serialize runs so two quick pushes can't race on deleting/recreating the
# same "dev" tag; cancel any in-flight run in favor of the newer commit.
concurrency:
group: dev-release
cancel-in-progress: true
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: darwin
goarch: arm64
- goos: darwin
goarch: amd64
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: windows
goarch: amd64
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version: '1.24'
- uses: actions/setup-node@v6
with:
node-version: '22'
- name: Build UI
run: |
cd ui && npm ci && npm run build && cd ..
cp -r ui/dist cmd/continuity/ui
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: '0'
run: |
COMMIT=$(git rev-parse --short HEAD)
VERSION="dev-${COMMIT}"
DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS="-X github.com/lazypower/continuity/internal/buildinfo.Version=${VERSION}"
LDFLAGS="${LDFLAGS} -X github.com/lazypower/continuity/internal/buildinfo.Commit=${COMMIT}"
LDFLAGS="${LDFLAGS} -X github.com/lazypower/continuity/internal/buildinfo.BuildDate=${DATE}"
EXT=""
if [ "${{ matrix.goos }}" = "windows" ]; then EXT=".exe"; fi
go build -ldflags "${LDFLAGS}" -o "continuity-${{ matrix.goos }}-${{ matrix.goarch }}${EXT}" ./cmd/continuity
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: continuity-${{ matrix.goos }}-${{ matrix.goarch }}
# Anchor to the per-matrix binary name (with optional .exe for windows)
# so an unanchored continuity-* glob doesn't also ship committed docs.
path: continuity-${{ matrix.goos }}-${{ matrix.goarch }}*
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v7
with:
path: artifacts
merge-multiple: true
- name: Publish rolling dev release
env:
GH_TOKEN: ${{ github.token }}
run: |
# "dev" is a single prerelease that always points at the latest main.
# Delete the previous release and its tag, then recreate at the current
# commit so the tag moves forward and stale assets don't linger. It is
# marked --prerelease so it never becomes GitHub's "latest" — install.sh
# and the stable homebrew formula keep tracking tagged releases only.
gh release delete dev --repo lazypower/continuity --yes --cleanup-tag || true
gh release create dev artifacts/continuity-* \
--repo lazypower/continuity \
--target "${GITHUB_SHA}" \
--title "continuity dev (main)" \
--notes "Rolling build of main @ ${GITHUB_SHA}. Unstable — tracks the tip of main. Install: brew install lazypower/tap/continuity-dev" \
--prerelease
homebrew:
needs: release
runs-on: ubuntu-latest
steps:
- name: Update Homebrew dev formula
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
GH_TOKEN: ${{ github.token }}
run: |
if [ -z "$HOMEBREW_TAP_TOKEN" ]; then
echo "HOMEBREW_TAP_TOKEN not set, skipping Homebrew update"
exit 0
fi
# The download URLs point at the fixed "dev" tag, so the formula version
# exists only to drive `brew upgrade`. A monotonic UTC timestamp keeps it
# strictly increasing; the sha256 changes each build and forces a
# re-download from the same URL.
VERSION=$(date -u +%Y.%m.%d.%H%M%S)
COMMIT=$(echo "${GITHUB_SHA}" | cut -c1-7)
# Compute checksums from the freshly published dev assets
gh release download dev --repo lazypower/continuity -p "continuity-darwin-arm64" -D /tmp
SHA_DARWIN_ARM64=$(sha256sum /tmp/continuity-darwin-arm64 | cut -d' ' -f1)
gh release download dev --repo lazypower/continuity -p "continuity-darwin-amd64" -D /tmp
SHA_DARWIN_AMD64=$(sha256sum /tmp/continuity-darwin-amd64 | cut -d' ' -f1)
gh release download dev --repo lazypower/continuity -p "continuity-linux-amd64" -D /tmp
SHA_LINUX_AMD64=$(sha256sum /tmp/continuity-linux-amd64 | cut -d' ' -f1)
gh release download dev --repo lazypower/continuity -p "continuity-linux-arm64" -D /tmp
SHA_LINUX_ARM64=$(sha256sum /tmp/continuity-linux-arm64 | cut -d' ' -f1)
# Generate the formula
cat > /tmp/continuity-dev.rb <<FORMULA
class ContinuityDev < Formula
desc "Persistent memory for AI coding agents (rolling dev build of main)"
homepage "https://github.com/lazypower/continuity"
version "${VERSION}"
license "MIT"
# Tracks the tip of main via the rolling "dev" prerelease and installs
# the same "continuity" binary as the stable formula, so the dev and
# stable channels are mutually exclusive.
conflicts_with "continuity", because: "both install the continuity binary"
on_macos do
on_arm do
url "https://github.com/lazypower/continuity/releases/download/dev/continuity-darwin-arm64"
sha256 "${SHA_DARWIN_ARM64}"
def install
bin.install "continuity-darwin-arm64" => "continuity"
end
end
on_intel do
url "https://github.com/lazypower/continuity/releases/download/dev/continuity-darwin-amd64"
sha256 "${SHA_DARWIN_AMD64}"
def install
bin.install "continuity-darwin-amd64" => "continuity"
end
end
end
on_linux do
on_arm do
url "https://github.com/lazypower/continuity/releases/download/dev/continuity-linux-arm64"
sha256 "${SHA_LINUX_ARM64}"
def install
bin.install "continuity-linux-arm64" => "continuity"
end
end
on_intel do
url "https://github.com/lazypower/continuity/releases/download/dev/continuity-linux-amd64"
sha256 "${SHA_LINUX_AMD64}"
def install
bin.install "continuity-linux-amd64" => "continuity"
end
end
end
test do
assert_match "continuity", shell_output("#{bin}/continuity version")
end
end
FORMULA
# Strip leading whitespace from heredoc indentation
sed -i 's/^ //' /tmp/continuity-dev.rb
# Clone tap, update formula, push
git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/lazypower/homebrew-tap.git" /tmp/tap
cp /tmp/continuity-dev.rb /tmp/tap/Formula/continuity-dev.rb
cd /tmp/tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/continuity-dev.rb
git commit -m "continuity-dev ${VERSION} (${COMMIT})"
git push