-
Notifications
You must be signed in to change notification settings - Fork 1
283 lines (250 loc) · 9.09 KB
/
release.yml
File metadata and controls
283 lines (250 loc) · 9.09 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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
name: Release
on:
push:
branches:
- master
- main
paths:
- 'src/**'
- 'src-tauri/**'
- 'cli/**'
- 'package.json'
- 'package-lock.json'
- 'tsconfig*.json'
- 'vite.config.ts'
- 'tailwind.config.js'
- 'postcss.config.js'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/release.yml'
tags:
- 'v*'
workflow_dispatch:
inputs:
bump:
description: 'Version bump type'
required: false
default: 'patch'
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
concurrency:
group: release
cancel-in-progress: false
jobs:
bump-and-release:
name: Bump Version & Create Release
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'chore: bump version')"
outputs:
release_id: ${{ steps.create_release.outputs.id }}
version: ${{ steps.bump.outputs.new_version }}
tag_name: ${{ steps.bump.outputs.tag_name }}
should_build: ${{ steps.bump.outputs.should_build }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Bump version
id: bump
run: |
CURRENT=$(jq -r .version src-tauri/tauri.conf.json)
echo "Current version: $CURRENT"
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
NEW_VERSION="${GITHUB_REF#refs/tags/v}"
echo "Tag push: using version $NEW_VERSION"
elif [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
BUMP="${{ github.event.inputs.bump }}"
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
case "$BUMP" in
major) NEW_VERSION="$((MAJOR+1)).0.0" ;;
minor) NEW_VERSION="${MAJOR}.$((MINOR+1)).0" ;;
patch) NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH+1))" ;;
esac
else
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH+1))"
echo "Branch push: auto bumping patch $CURRENT → $NEW_VERSION"
fi
TAG_NAME="v${NEW_VERSION}"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
echo "should_build=true" >> $GITHUB_OUTPUT
# Update version in config files (only for non-tag pushes)
if [[ "$GITHUB_REF" != refs/tags/v* ]]; then
jq --arg v "$NEW_VERSION" '.version = $v' src-tauri/tauri.conf.json > tmp.json && mv tmp.json src-tauri/tauri.conf.json
jq --arg v "$NEW_VERSION" '.version = $v' package.json > tmp.json && mv tmp.json package.json
sed -i "s/^version = \".*\"/version = \"$NEW_VERSION\"/" Cargo.toml
fi
- name: Commit version bump
if: github.ref != 'refs/tags/*'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet; then
echo "No version changes to commit"
else
git add src-tauri/tauri.conf.json package.json Cargo.toml
git commit -m "chore: bump version to ${{ steps.bump.outputs.new_version }} [skip ci]"
git push origin HEAD:${{ github.ref_name }}
fi
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.bump.outputs.tag_name }}
name: VibeShell ${{ steps.bump.outputs.tag_name }}
body: |
## VibeShell ${{ steps.bump.outputs.tag_name }}
### Downloads
| Platform | Installer | CLI Only |
|----------|-----------|----------|
| Windows x64 | `.exe` / `.msi` | `vshell-windows-x64.exe` |
| macOS (Apple Silicon) | `.dmg` | `vshell-macos-arm64` |
| macOS (Intel) | `.dmg` | `vshell-macos-x64` |
| Linux x64 | `.deb` / `.AppImage` | `vshell-linux-x64` |
> **Note:** The desktop installer includes `vshell` CLI and adds it to your PATH automatically.
See [commit history](https://github.com/${{ github.repository }}/commits/${{ steps.bump.outputs.tag_name }}) for full changes.
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-tauri:
name: Build (${{ matrix.name }})
needs: bump-and-release
if: needs.bump-and-release.outputs.should_build == 'true'
strategy:
fail-fast: false
matrix:
include:
- platform: windows-latest
name: Windows x64
args: ''
target: x86_64-pc-windows-msvc
- platform: macos-latest
name: macOS ARM64
args: '--target aarch64-apple-darwin'
target: aarch64-apple-darwin
- platform: macos-latest
name: macOS x64
args: '--target x86_64-apple-darwin'
target: x86_64-apple-darwin
- platform: ubuntu-22.04
name: Linux x64
args: ''
target: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Install frontend dependencies
run: npm ci
- name: Build vshell CLI
shell: bash
run: |
if [[ "${{ matrix.target }}" != "" && "${{ matrix.args }}" == *"--target"* ]]; then
cargo build --release --package vshell --target ${{ matrix.target }}
else
cargo build --release --package vshell
fi
- name: Copy vshell to sidecar location
shell: bash
run: |
mkdir -p src-tauri/binaries
TARGET="${{ matrix.target }}"
EXT=""
if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then
EXT=".exe"
fi
# Determine source path
if [[ "${{ matrix.args }}" == *"--target"* ]]; then
SRC="target/${TARGET}/release/vshell${EXT}"
else
SRC="target/release/vshell${EXT}"
fi
DEST="src-tauri/binaries/vshell-${TARGET}${EXT}"
echo "Copying $SRC -> $DEST"
cp "$SRC" "$DEST"
chmod +x "$DEST" 2>/dev/null || true
ls -la src-tauri/binaries/
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ needs.bump-and-release.outputs.release_id }}
args: ${{ matrix.args }}
- name: Rename and upload vshell CLI binary
shell: bash
run: |
VERSION="${{ needs.bump-and-release.outputs.version }}"
TARGET="${{ matrix.target }}"
EXT=""
if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then
EXT=".exe"
fi
# Find the built vshell binary
if [[ "${{ matrix.args }}" == *"--target"* ]]; then
BINARY="target/${TARGET}/release/vshell${EXT}"
else
BINARY="target/release/vshell${EXT}"
fi
# Determine platform-friendly name
case "${{ matrix.platform }}" in
windows-latest)
DEST="vshell-${VERSION}-windows-x64.exe"
;;
macos-latest)
if [[ "${{ matrix.args }}" == *"aarch64"* ]]; then
DEST="vshell-${VERSION}-macos-arm64"
else
DEST="vshell-${VERSION}-macos-x64"
fi
;;
ubuntu-22.04)
DEST="vshell-${VERSION}-linux-x64"
;;
esac
if [ -f "$BINARY" ]; then
cp "$BINARY" "$DEST"
echo "VSHELL_BINARY=$DEST" >> $GITHUB_ENV
else
echo "Warning: vshell binary not found at $BINARY"
fi
- name: Upload vshell CLI to release
if: env.VSHELL_BINARY != ''
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.bump-and-release.outputs.tag_name }}
files: ${{ env.VSHELL_BINARY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}