-
Notifications
You must be signed in to change notification settings - Fork 0
255 lines (217 loc) · 9.29 KB
/
Copy pathrelease.yml
File metadata and controls
255 lines (217 loc) · 9.29 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Release version (e.g. 1.0.0)"
required: true
type: string
jobs:
build:
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
artifact-name: release-macos
- os: windows-latest
artifact-name: release-windows
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
cache: "npm"
cache-dependency-path: |
app/package-lock.json
- name: Pin npm version
run: npm install -g npm@11.11.0
- name: Show tool versions
run: |
node --version
npm --version
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: "app/src-tauri -> target"
- name: Install npm dependencies
working-directory: app
run: npm ci
- name: Stamp version into config files
working-directory: app
shell: bash
env:
RELEASE_VERSION: ${{ inputs.version }}
run: |
# Tauri config only accepts X.Y.Z — strip any pre-release suffix (e.g. 0.9.7-rc1 → 0.9.7)
TAURI_VERSION="${RELEASE_VERSION%%-*}"
export TAURI_VERSION
node -e "const fs=require('fs'); const f='src-tauri/tauri.conf.json'; const c=JSON.parse(fs.readFileSync(f,'utf8')); c.version=process.env.TAURI_VERSION; fs.writeFileSync(f,JSON.stringify(c,null,2)+'\n');"
node -e "const fs=require('fs'); const f='package.json'; const c=JSON.parse(fs.readFileSync(f,'utf8')); c.version=process.env.RELEASE_VERSION; fs.writeFileSync(f,JSON.stringify(c,null,2)+'\n');"
sed -i.bak "s/^version = \".*\"/version = \"${RELEASE_VERSION}\"/" src-tauri/Cargo.toml && rm -f src-tauri/Cargo.toml.bak
- name: Download uv binary (macOS)
if: matrix.os == 'macos-latest'
env:
UV_VERSION: "0.5.0"
run: |
curl -fsSL \
"https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-aarch64-apple-darwin.tar.gz" \
-o uv.tar.gz
mkdir uv-bin
tar xzf uv.tar.gz -C uv-bin
UV_BIN=$(find uv-bin -name "uv" -not -name "uvx" -type f | head -1)
chmod +x "$UV_BIN"
echo "UV_BIN=$UV_BIN" >> "$GITHUB_ENV"
rm uv.tar.gz
- name: Download uv binary (Windows)
if: matrix.os == 'windows-latest'
env:
UV_VERSION: "0.5.0"
shell: bash
run: |
curl -fsSL \
"https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-x86_64-pc-windows-msvc.zip" \
-o uv.zip
mkdir uv-bin
7z x uv.zip -ouv-bin -y
UV_BIN=$(find uv-bin -name "uv.exe" -type f | head -1)
echo "UV_BIN=$UV_BIN" >> "$GITHUB_ENV"
rm uv.zip
- name: Build Tauri app (macOS)
if: matrix.os == 'macos-latest'
working-directory: app
run: npx tauri build --bundles app
- name: Build Tauri app (Windows)
if: matrix.os == 'windows-latest'
working-directory: app
run: npx tauri build --no-bundle
- name: Package macOS release
if: matrix.os == 'macos-latest'
shell: bash
env:
VERSION: ${{ inputs.version }}
run: |
STAGE="SkillBuilder-v${VERSION}-macos"
mkdir -p "$STAGE"
cp -R "app/src-tauri/target/release/bundle/macos/Skill Builder.app" "$STAGE/"
# Inject bundled uv and workspace assets into the app bundle under runtime/
mkdir -p "$STAGE/Skill Builder.app/Contents/Resources/runtime/workspace"
cp "$UV_BIN" "$STAGE/Skill Builder.app/Contents/Resources/runtime/uv"
chmod +x "$STAGE/Skill Builder.app/Contents/Resources/runtime/uv"
cp -r "agent-sources/workspace/." "$STAGE/Skill Builder.app/Contents/Resources/runtime/workspace/"
cat > "$STAGE/run.sh" << 'SCRIPT'
#!/bin/bash
DIR="$(cd "$(dirname "$0")" && pwd)"
xattr -cr "$DIR/Skill Builder.app"
open -n "$DIR/Skill Builder.app"
SCRIPT
chmod +x "$STAGE/run.sh"
node scripts/ci/verify-release-stage.mjs "$STAGE" macos
zip -r "${STAGE}.zip" "$STAGE"
- name: Package Windows release
if: matrix.os == 'windows-latest'
shell: bash
env:
VERSION: ${{ inputs.version }}
run: |
STAGE="SkillBuilder-v${VERSION}-windows"
mkdir -p "$STAGE"
cp "app/src-tauri/target/release/skill-builder.exe" "$STAGE/"
mkdir -p "$STAGE/runtime/workspace"
cp -r "agent-sources/workspace/." "$STAGE/runtime/workspace/"
# Include bundled uv under runtime/ so users don't need uv pre-installed
cp "$UV_BIN" "$STAGE/runtime/uv.exe"
node scripts/ci/verify-release-stage.mjs "$STAGE" windows
7z a "${STAGE}.zip" "$STAGE"
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact-name }}
path: SkillBuilder-v*.zip
release:
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
- name: Generate release notes
id: notes
shell: bash
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
RELEASE_VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
# Tags are already available from checkout (fetch-depth: 0)
# Determine the previous tag (most recent tag before the current one)
PREVIOUS_TAG=$(git tag --sort=-creatordate | grep '^v' | head -2 | tail -1)
# Build the commit log (use HEAD since the release tag doesn't exist yet)
if [ -z "$PREVIOUS_TAG" ]; then
# No previous tag — use all commits
COMMITS=$(git log --oneline --format="%s" HEAD)
else
COMMITS=$(git log --oneline --format="%s" "${PREVIOUS_TAG}..HEAD")
fi
if [ -z "$COMMITS" ]; then
COMMITS="No commits found for this release."
fi
# Build a simple bullet-list fallback from commit subjects
FALLBACK=$(echo "$COMMITS" | sed 's/^/- /')
NOTES=""
# Attempt AI-generated release notes
if [ -n "${ANTHROPIC_API_KEY:-}" ]; then
# Build the JSON payload safely with jq env vars (avoids shell expansion issues
# when commit messages contain quotes, backticks, or dollar signs)
export COMMITS
PAYLOAD=$(jq -n '{
model: "claude-haiku-4-5-20251001",
max_tokens: 1024,
messages: [{
role: "user",
content: ("You are writing release notes for Skill Builder v" + env.RELEASE_VERSION + ", a desktop app for building AI skills.\n\nSummarize the git commits below into polished, user-facing release notes.\n\nFormat:\n1. Start with 1-2 sentences highlighting the most notable change(s)\n2. Then group changes under these markdown headings (omit any with no items):\n ### Highlights\n ### New\n ### Improved\n ### Fixed\n\nOnly add a ### Breaking Changes section if there are changes that require user action.\n\nWriting style:\n- Write for end users, not developers\n- Keep each bullet to one concise sentence\n- Describe what changed from the user perspective, not the code perspective\n- No commit hashes, file paths, PR numbers, or technical jargon\n- If multiple commits relate to the same user-facing change, combine them into one bullet\n\nCommits:\n" + env.COMMITS)
}]
}')
RESPONSE=$(curl -s --max-time 60 \
-H "x-api-key: ${ANTHROPIC_API_KEY}" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d "$PAYLOAD" \
"https://api.anthropic.com/v1/messages" 2>/dev/null) || true
if [ -n "${RESPONSE:-}" ]; then
NOTES=$(echo "$RESPONSE" | jq -r '.content[0].text // empty' 2>/dev/null) || true
fi
fi
# Fall back to simple commit list if AI summary is empty
if [ -z "${NOTES:-}" ]; then
NOTES=$(printf "### What's Changed\n\n%s" "$FALLBACK")
fi
# Write multiline output
echo "release_notes<<EOF" >> "$GITHUB_OUTPUT"
echo "$NOTES" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ github.event.inputs.version }}
name: Skill Builder v${{ github.event.inputs.version }}
body: ${{ steps.notes.outputs.release_notes }}
files: artifacts/**/*.zip