-
-
Notifications
You must be signed in to change notification settings - Fork 111
145 lines (132 loc) · 5.43 KB
/
build.yml
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
name: Build
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: SonarCloud Scan Electron
uses: SonarSource/sonarcloud-github-action@master
with:
projectBaseDir: electron
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: SonarCloud Scan Client
uses: SonarSource/sonarcloud-github-action@master
with:
projectBaseDir: client
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-15, macos-latest, windows-latest]
node-version: [22.x]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest
run_install: false
- name: Get Package Version
id: package_version
shell: bash
run: echo "PACKAGE_VERSION=$(node -p -e "require('./electron/package.json').version")" >> $GITHUB_ENV
- name: Setup Sentry Release
if: matrix.os == 'ubuntu-latest'
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
run: |
pnpm dlx @sentry/cli releases set-commits "${{ env.PACKAGE_VERSION }}" --commit "${{ github.repository }}@${{ github.sha }}"
pnpm dlx @sentry/cli releases new "${{ env.PACKAGE_VERSION }}"
- name: Install Dependencies (Electron)
shell: bash
run: |
cd electron
if [ "${{ matrix.os }}" = "macos-15" ]; then
export npm_config_arch=x64
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
export npm_config_arch=arm64
fi
pnpm install --no-frozen-lockfile
cd ..
- name: Install Dependencies (Client)
run: |
cd client
pnpm install --no-frozen-lockfile
cd ..
- name: Build Client
run: |
cd client
pnpm build
cd ..
- name: Create .env file
shell: bash
run: |
cd electron
echo "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" >> .env
echo "APPLE_ID=${{ secrets.APPLE_ID }}" >> .env
echo "APPLE_ID_PASSWORD=${{ secrets.APPLE_ID_PASSWORD }}" >> .env
echo "APPLE_TEAM_ID=${{ secrets.APPLE_TEAM_ID }}" >> .env
cd ..
- name: Build and Release Electron App
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG: electron-builder,electron-builder:*
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
CSC_IDENTITY_AUTO_DISCOVERY: ${{ matrix.os != 'windows-latest' }}
run: |
cd electron
pnpm build
pnpm prepare_client
# Determine the architecture to build
if [ "${{ matrix.os }}" = "macos-15" ]; then
ARCH="x64"
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
ARCH="arm64"
fi
pnpm release -- --mac --${ARCH}
cd ..
- name: Upload Sentry Sourcemaps
if: matrix.os == 'ubuntu-latest'
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
run: |
pnpm dlx @sentry/cli releases files "${{ env.PACKAGE_VERSION }}" upload-sourcemaps ./client/dist/assets/ --rewrite --url-prefix "~/dist/assets"
pnpm dlx @sentry/cli releases files "${{ env.PACKAGE_VERSION }}" list
pnpm dlx @sentry/cli releases finalize "${{ env.PACKAGE_VERSION }}"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-build
path: |
electron/packaged/*.dmg
electron/packaged/*.AppImage
electron/packaged/*.deb
electron/packaged/*.rpm
electron/packaged/*.exe
electron/packaged/*.msi