-
Notifications
You must be signed in to change notification settings - Fork 22
265 lines (215 loc) · 7.21 KB
/
Copy pathpublish.yml
File metadata and controls
265 lines (215 loc) · 7.21 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
name: Publish to npm
on:
push:
branches:
- main
jobs:
check:
name: Lint & Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Setup mise
uses: jdx/mise-action@v2
- name: Install dependencies
run: bun install
- name: Run lint
run: mise run lint
- name: Run typecheck
run: mise run typecheck
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Setup mise
uses: jdx/mise-action@v2
- name: Setup uv
uses: astral-sh/setup-uv@v4
- name: Install dependencies
run: bun install
- name: Run tests
run: mise run test
publish:
needs: [check, test]
runs-on: ubuntu-latest
environment: npm-publish
permissions:
contents: write
id-token: write # Required for OIDC
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
should_release: ${{ steps.check_tag.outputs.exists == 'false' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from package.json
id: version
run: |
VERSION=$(jq -r '.version' package.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: check_tag
run: |
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Setup Bun
if: steps.check_tag.outputs.exists == 'false'
uses: oven-sh/setup-bun@v2
- name: Setup Node.js
if: steps.check_tag.outputs.exists == 'false'
uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- name: Setup mise
if: steps.check_tag.outputs.exists == 'false'
uses: jdx/mise-action@v2
- name: Install dependencies
if: steps.check_tag.outputs.exists == 'false'
run: bun install
- name: Verify version sync
if: steps.check_tag.outputs.exists == 'false'
run: mise run check:version
- name: Build CLI
if: steps.check_tag.outputs.exists == 'false'
run: mise run cli:build
- name: Publish to npm
if: steps.check_tag.outputs.exists == 'false'
working-directory: cli
run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create and push tag
if: steps.check_tag.outputs.exists == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ steps.version.outputs.tag }}
git push origin ${{ steps.version.outputs.tag }}
- name: Generate changelog
if: steps.check_tag.outputs.exists == 'false'
id: changelog
run: |
PREVIOUS_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]' | head -2 | tail -1)
if [ -z "$PREVIOUS_TAG" ]; then
CHANGELOG=$(git log --pretty=format:"- %s" HEAD)
else
CHANGELOG=$(git log --pretty=format:"- %s" ${PREVIOUS_TAG}..HEAD~1)
fi
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub Release
if: steps.check_tag.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.tag }}
draft: false
body: |
## Changes
${{ steps.changelog.outputs.changelog }}
## Installation
### Desktop App (Recommended)
Download the appropriate package for your platform:
- **macOS (Apple Silicon)**: `Vibora-${{ steps.version.outputs.version }}-macos-arm64.dmg`
- **Linux (x64)**: `Vibora-${{ steps.version.outputs.version }}-linux-x64.AppImage`
### CLI
```bash
npm install -g vibora
```
# Desktop builds - run in parallel on multiple platforms
build-desktop:
needs: publish
if: needs.publish.outputs.should_release == 'true'
strategy:
fail-fast: false
matrix:
include:
# macOS Apple Silicon
- os: macos-latest
platform: macos
arch: arm64
artifact: Vibora-${{ needs.publish.outputs.version }}-macos-arm64.dmg
# Linux x64
- os: ubuntu-latest
platform: linux
arch: x64
artifact: Vibora-${{ needs.publish.outputs.version }}-linux-x64.AppImage
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Setup mise
uses: jdx/mise-action@v2
- name: Install dependencies
run: bun install
- name: Install create-dmg (macOS)
if: matrix.platform == 'macos'
run: brew install create-dmg
- name: Install Linux dependencies
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y libfuse2
- name: Build Neutralino app
run: mise run desktop:build
- name: Bundle server
run: mise run desktop:bundle
- name: Package DMG (macOS)
if: matrix.platform == 'macos'
run: ./desktop/scripts/package-dmg.sh ${{ matrix.arch }}
- name: Package AppImage (Linux)
if: matrix.platform == 'linux'
run: ./desktop/scripts/package-appimage.sh ${{ matrix.arch }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: desktop-${{ matrix.platform }}-${{ matrix.arch }}
path: desktop/dist/${{ matrix.artifact }}
# Finalize release with all desktop builds
finalize-release:
needs: [publish, build-desktop]
if: needs.publish.outputs.should_release == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all desktop artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: desktop-*
- name: Flatten artifacts
run: |
mkdir -p release-assets
find artifacts -type f \( -name "*.dmg" -o -name "*.AppImage" \) -exec cp {} release-assets/ \;
ls -la release-assets/
- name: Upload assets to release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.publish.outputs.tag }}
draft: false
files: release-assets/*