generated from maximegris/angular-electron
-
-
Notifications
You must be signed in to change notification settings - Fork 96
223 lines (192 loc) · 7.42 KB
/
release.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
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
name: 'Release'
run-name: "${{ github.event_name == 'release' && format('Release {0}', github.ref_name) || format('Snapshot {0}', github.sha) }}"
on:
release:
types: [ published ]
workflow_dispatch:
env:
TAURI_BUILD_FLAGS: "${{ github.event_name == 'release' && ' ' || '-d' }}"
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: webosbrew
SENTRY_PROJECT: dev-manager-desktop-ui
SENTRY_ENVIRONMENT: "${{ github.event_name == 'release' && 'release' || 'development' }}"
ANDROID_NDK_VERSION: '26.3.11579264'
ANDROID_BUILD_TOOLS_VERSION: '34.0.0'
jobs:
sentry-create-release:
name: Create Sentry Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Extract Version
id: pkg-version
uses: saionaro/extract-package-version@v1.3.0
- name: Generate Sentry Release Name
id: release-info
uses: actions/github-script@v7
with:
script: |
if (process.env.SENTRY_ENVIRONMENT !== 'release') {
return "${{ steps.pkg-version.outputs.version }}-" + context.sha.substring(0, 7);
} else {
return "${{ steps.pkg-version.outputs.version }}";
}
result-encoding: string
- uses: getsentry/action-release@v1
name: Create Sentry Release
with:
version: ${{ steps.release-info.outputs.result }}
ignore_missing: true
ignore_empty: true
finalize: false
outputs:
release: ${{ steps.release-info.outputs.result }}
build:
name: Build Package
strategy:
fail-fast: false
matrix:
include:
- target: windows
os: windows-latest
- target: linux-x86_64
os: ubuntu-22.04
- target: linux-arm64
os: debian-arm64-latest
- target: macos
os: macos-latest
- target: android
os: ubuntu-22.04
runs-on: ${{ matrix.os }}
needs: sentry-create-release
steps:
- uses: actions/checkout@v4
- name: Install Required Packages (Linux)
if: startsWith(matrix.target, 'linux')
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl wget file libssl-dev libayatana-appindicator3-dev \
libwebkit2gtk-4.1-dev librsvg2-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Setup JDK (Android)
uses: actions/setup-java@v4
if: startsWith(matrix.target, 'android')
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
if: startsWith(matrix.target, 'android')
uses: android-actions/setup-android@v3
with:
packages: "build-tools;${{ env.ANDROID_BUILD_TOOLS_VERSION}} ndk;${{ env.ANDROID_NDK_VERSION }} platforms;android-33"
- name: Add Android SDK Paths
if: startsWith(matrix.target, 'android')
shell: bash
run: |
echo ${NDK_HOME}/toolchains/llvm/prebuilt/*/bin >> $GITHUB_PATH
echo ${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS_VERSION} >> $GITHUB_PATH
env:
NDK_HOME: "${{ env.ANDROID_HOME }}/ndk/${{ env.ANDROID_NDK_VERSION }}"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Write Version
uses: actions/github-script@v7
with:
script: |
const release = "${{ needs.sentry-create-release.outputs.release }}".trim();
if (!release) {
core.setFailed('Sentry release was not found');
return;
}
const fs = require('fs');
fs.writeFileSync('src/release.json', JSON.stringify({
version: release
}));
- name: Install NPM Dependencies
run: npm ci
- name: Build the app (Windows)
if: startsWith(matrix.target, 'windows')
run: |
rustup target add i686-pc-windows-msvc
npm run build -- --features=vendored-openssl --target x86_64-pc-windows-msvc ${{ env.TAURI_BUILD_FLAGS }}
npm run build -- --features=vendored-openssl --target i686-pc-windows-msvc ${{ env.TAURI_BUILD_FLAGS }}
- name: Build the app (Linux)
if: startsWith(matrix.target, 'linux')
run: npm run build -- --features=vendored-openssl ${{ env.TAURI_BUILD_FLAGS }}
- name: Build the app (macOS)
if: startsWith(matrix.target, 'macos')
run: |
rustup target add x86_64-apple-darwin aarch64-apple-darwin
npm run build -- --features=vendored-openssl --target universal-apple-darwin ${{ env.TAURI_BUILD_FLAGS }}
env:
CI: true
- name: Build the app (Android)
if: startsWith(matrix.target, 'android')
shell: bash
run: |
# TODO: Remove this once patches are merged
cargo install --git https://github.com/mariotaku/tauri.git --rev 1ec4cb57 tauri-cli --force
npm run tauri android init
npm run tauri android build -- --aab
if [ -n "$AAB_SIGNING_KEYSTORE" ]; then
echo "$AAB_SIGNING_KEYSTORE" | base64 -d | apksigner sign --ks /dev/stdin \
--ks-pass env:AAB_SIGNING_PASSWORD \
--min-sdk-version 28 \
src-tauri/gen/android/app/build/outputs/bundle/universalRelease/*.aab
fi
env:
NDK_HOME: "${{ env.ANDROID_HOME }}/ndk/${{ env.ANDROID_NDK_VERSION }}"
AAB_SIGNING_KEYSTORE: ${{ secrets.AAB_SIGNING_KEYSTORE }}
AAB_SIGNING_PASSWORD: ${{ secrets.AAB_SIGNING_PASSWORD }}
- name: Upload Source Maps
run: npx --yes @sentry/cli sourcemaps upload -r ${{ needs.sentry-create-release.outputs.release }} dist
- name: Glob Build Artifacts
uses: tj-actions/glob@v22
id: glob
with:
separator: "\n"
read-gitignore: false
files: |
src-tauri/gen/android/app/build/outputs/bundle/universalRelease/*.aab
target/**/bundle/deb/*.deb
target/**/bundle/rpm/*.rpm
target/**/bundle/appimage/*.AppImage
target/**/bundle/msi/*.msi
target/**/bundle/dmg/*.dmg
- name: Upload Artifact
uses: actions/upload-artifact@v4
if: ${{ startsWith(matrix.target, 'android') || github.event_name != 'release' }}
with:
name: ${{ matrix.target }}-package
path: ${{ steps.glob.outputs.paths }}
- name: Create Release
uses: ncipollo/release-action@v1
if: ${{ !startsWith(matrix.target, 'android') && github.event_name == 'release' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Dev Manager ${{ github.ref_name }}
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate: true
artifacts: ${{ steps.glob.outputs.paths }}
sentry-finalize-release:
name: Finalize Sentry Release
runs-on: ubuntu-latest
needs: [ sentry-create-release, build ]
steps:
- uses: actions/checkout@v4
- uses: getsentry/action-release@v1
with:
version: ${{ needs.sentry-create-release.outputs.release }}
ignore_missing: true
ignore_empty: true
finalize: false