generated from maximegris/angular-electron
-
-
Notifications
You must be signed in to change notification settings - Fork 81
169 lines (143 loc) · 5.51 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
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' }}"
jobs:
sentry-create-release:
name: Create Sentry Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Extract Version
id: pkg-version
uses: Saionaro/[email protected]
- name: Generate Sentry Release Name
id: release-info
uses: actions/github-script@v6
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:
os: [ windows-latest, ubuntu-20.04, macos-latest ]
runs-on: ${{ matrix.os }}
needs: sentry-create-release
steps:
- uses: actions/checkout@v4
- name: Cache Node Modules
uses: actions/cache@v3
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node_modules
- name: Install Required Packages (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Write Version
uses: actions/github-script@v6
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: runner.os == '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: runner.os == 'Linux'
run: npm run build -- --features=vendored-openssl ${{ env.TAURI_BUILD_FLAGS }}
- name: Build the app (macOS)
if: runner.os == 'macOS'
run: |
# Blocked by https://github.com/webosbrew/dev-manager-desktop/issues/116
# rustup target add aarch64-apple-darwin
# npm run build -- --features=vendored-openssl --target universal-apple-darwin ${{ env.TAURI_BUILD_FLAGS }}
npm run build -- --features=vendored-openssl ${{ env.TAURI_BUILD_FLAGS }}
- name: Upload Source Maps
run: npx --yes @sentry/cli sourcemaps upload -r ${{ needs.sentry-create-release.outputs.release }} dist
- name: Upload Artifact
uses: actions/upload-artifact@v3
if: github.event_name != 'release'
with:
name: ${{ runner.os }}-snapshot
path: |
src-tauri/target/**/bundle/deb/*.deb
src-tauri/target/**/bundle/appimage/*.AppImage
src-tauri/target/**/bundle/msi/*.msi
src-tauri/target/**/bundle/dmg/*.dmg
- name: Create Release
uses: ncipollo/release-action@v1
if: github.event_name == 'release'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Dev Manager ${{ github.ref_name }}
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate: true
artifacts: "src-tauri/target/**/bundle/deb/*.deb,\
src-tauri/target/**/bundle/appimage/*.AppImage,\
src-tauri/target/**/bundle/msi/*.msi,\
src-tauri/target/**/bundle/dmg/*.dmg"
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