-
Notifications
You must be signed in to change notification settings - Fork 0
325 lines (278 loc) · 10.5 KB
/
build-and-release.yml
File metadata and controls
325 lines (278 loc) · 10.5 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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
name: Build and Release
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
release_type:
description: 'Release type (major, minor, patch)'
required: false
default: 'patch'
type: choice
options:
- major
- minor
- patch
# Global permissions for the workflow
permissions:
contents: write # Required to push tags and create releases
issues: write # Required to create issues on failure
pull-requests: write # Required for PR comments
actions: read # Required to read workflow information
checks: read # Required to read check status
env:
NODE_VERSION: '20'
CACHE_VERSION: v1
jobs:
# Test and lint job
test:
name: Test and Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint
- name: Build application
run: npm run build
# Semantic versioning and release preparation
semantic-version:
name: Semantic Versioning
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
outputs:
new-release-published: ${{ steps.semantic.outputs.new-release-published }}
new-release-version: ${{ steps.semantic.outputs.new-release-version }}
new-release-major-version: ${{ steps.semantic.outputs.new-release-major-version }}
new-release-minor-version: ${{ steps.semantic.outputs.new-release-minor-version }}
new-release-patch-version: ${{ steps.semantic.outputs.new-release-patch-version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Configure Git
run: |
git config --global user.email "action@github.com"
git config --global user.name "github-actions[bot]"
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 22
extra_plugins: |
@semantic-release/changelog@6
@semantic-release/git@10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Build job for multiple platforms
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: [test, semantic-version]
if: always() && needs.test.result == 'success' && (needs.semantic-version.result == 'success' || needs.semantic-version.result == 'skipped')
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
platform: win32
arch: x64
npm_config_cache: ~/.npm
- os: windows-latest
platform: win32
arch: ia32
npm_config_cache: ~/.npm
- os: ubuntu-latest
platform: linux
arch: x64
npm_config_cache: ~/.npm
- os: macos-latest
platform: darwin
arch: x64
npm_config_cache: ~/.npm
- os: macos-latest
platform: darwin
arch: arm64
npm_config_cache: ~/.npm
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Update version from semantic release
if: needs.semantic-version.outputs.new-release-published == 'true'
run: |
npm version ${{ needs.semantic-version.outputs.new-release-version }} --no-git-tag-version
- name: Build application
run: npm run build
- name: Build Electron app for ${{ matrix.platform }}-${{ matrix.arch }}
run: npm run electron:dist
env:
ELECTRON_BUILDER_ARCH: ${{ matrix.arch }}
ELECTRON_BUILDER_PLATFORM: ${{ matrix.platform }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: List build outputs
shell: bash
run: |
echo "Build outputs:"
if [ -d "release" ]; then
ls -la release/
else
echo "No release directory found"
fi
- name: Upload artifacts (Windows)
if: matrix.platform == 'win32'
uses: actions/upload-artifact@v4
with:
name: signalpath-windows-${{ matrix.arch }}
path: |
release/*.exe
release/*.msi
release/*.zip
retention-days: 30
- name: Upload artifacts (macOS)
if: matrix.platform == 'darwin'
uses: actions/upload-artifact@v4
with:
name: signalpath-macos-${{ matrix.arch }}
path: |
release/*.dmg
release/*.zip
retention-days: 30
- name: Upload artifacts (Linux)
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: signalpath-linux-${{ matrix.arch }}
path: |
release/*.AppImage
release/*.deb
release/*.tar.gz
retention-days: 30
# Create GitHub release with artifacts
release:
name: Create Release
runs-on: ubuntu-latest
needs: [semantic-version, build]
if: needs.semantic-version.outputs.new-release-published == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Display structure of downloaded files
run: find ./artifacts -type f -name "*" | head -20
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.semantic-version.outputs.new-release-version }}
name: SignalPath Intercom Designer v${{ needs.semantic-version.outputs.new-release-version }}
body: |
## 🚀 SignalPath Intercom Designer v${{ needs.semantic-version.outputs.new-release-version }}
### Downloads
#### Windows
- **Windows x64**: `SignalPath-Intercom-Designer-Setup-${{ needs.semantic-version.outputs.new-release-version }}.exe`
- **Windows x86**: `SignalPath-Intercom-Designer-Setup-${{ needs.semantic-version.outputs.new-release-version }}-ia32.exe`
#### macOS
- **macOS Intel**: `SignalPath-Intercom-Designer-${{ needs.semantic-version.outputs.new-release-version }}.dmg`
- **macOS Apple Silicon**: `SignalPath-Intercom-Designer-${{ needs.semantic-version.outputs.new-release-version }}-arm64.dmg`
#### Linux
- **Linux AppImage**: `SignalPath-Intercom-Designer-${{ needs.semantic-version.outputs.new-release-version }}.AppImage`
- **Linux DEB**: `signalpath_${{ needs.semantic-version.outputs.new-release-version }}_amd64.deb`
### Installation Instructions
#### Windows
1. Download the appropriate installer for your architecture
2. Run the installer and follow the setup wizard
3. Launch SignalPath from the Start Menu or Desktop shortcut
#### macOS
1. Download the DMG file for your Mac architecture
2. Open the DMG and drag SignalPath to Applications
3. Launch SignalPath from Applications or Launchpad
#### Linux
1. **AppImage**: Make executable (`chmod +x`) and run directly
2. **DEB**: Install with `sudo dpkg -i signalpath_${{ needs.semantic-version.outputs.new-release-version }}_amd64.deb`
---
**Full Changelog**: https://github.com/${{ github.repository }}/compare/v${{ needs.semantic-version.outputs.new-release-version }}...HEAD
files: |
./artifacts/**/*
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Manual release job for workflow_dispatch
manual-release:
name: Manual Release
runs-on: ubuntu-latest
needs: [test, build]
if: github.event_name == 'workflow_dispatch' && needs.test.result == 'success'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Bump version
id: version
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
NEW_VERSION=$(npm version ${{ github.event.inputs.release_type }} --no-git-tag-version)
echo "new-version=${NEW_VERSION}" >> $GITHUB_OUTPUT
echo "New version: ${NEW_VERSION}"
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Create Manual Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.new-version }}
name: SignalPath Intercom Designer ${{ steps.version.outputs.new-version }} (Manual Release)
body: |
## 🚀 SignalPath Intercom Designer ${{ steps.version.outputs.new-version }}
This is a manual release triggered via GitHub Actions workflow dispatch.
### Downloads
Please see the attached assets for platform-specific installers.
**Full Changelog**: https://github.com/${{ github.repository }}/commits/${{ steps.version.outputs.new-version }}
files: |
./artifacts/**/*
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}