Skip to content

Commit e2522ca

Browse files
committed
ci: add GitHub Actions workflow for automated app builds and releases
1 parent d50d939 commit e2522ca

File tree

3 files changed

+102
-26
lines changed

3 files changed

+102
-26
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Build and Release Electron App
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch: # Allow manual trigger
8+
9+
jobs:
10+
build:
11+
name: Build for ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
include:
16+
- os: macos-latest
17+
platform: mac
18+
arch: x64,arm64
19+
- os: windows-latest
20+
platform: win
21+
arch: x64
22+
- os: ubuntu-latest
23+
platform: linux
24+
arch: x64
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 20.16.0 # Project's Node version
36+
cache: pnpm
37+
38+
- name: Setup pnpm
39+
uses: pnpm/action-setup@v4
40+
with:
41+
version: latest
42+
43+
- name: Install dependencies
44+
run: pnpm install
45+
46+
- name: Rebuild native dependencies
47+
run: pnpm run rebuild
48+
49+
- name: Build application
50+
run: pnpm run build:${{ matrix.platform }}
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Upload artifacts
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: masscode-${{ matrix.platform }}-${{ github.ref_name }}
58+
path: |
59+
dist/*.dmg
60+
dist/*.pkg
61+
dist/*.exe
62+
dist/*.msi
63+
dist/*.AppImage
64+
dist/*.snap
65+
if-no-files-found: warn
66+
retention-days: 30
67+
68+
release:
69+
name: Create Release
70+
needs: build
71+
runs-on: ubuntu-latest
72+
if: startsWith(github.ref, 'refs/tags/v')
73+
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v4
77+
78+
- name: Download all artifacts
79+
uses: actions/download-artifact@v4
80+
with:
81+
path: artifacts
82+
83+
- name: Display structure of downloaded files
84+
run: ls -la artifacts/
85+
86+
- name: Get package version
87+
id: package-version
88+
run: |
89+
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
90+
91+
- name: Create Release
92+
id: create_release
93+
uses: softprops/action-gh-release@v2
94+
with:
95+
files: |
96+
artifacts/masscode-*/*
97+
draft: true
98+
generate_release_notes: true
99+
append_body: true
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-tag.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
[
88
'build',
99
'chore',
10+
'ci',
1011
'docs',
1112
'feat',
1213
'fix',

0 commit comments

Comments
 (0)