This repository has been archived by the owner on May 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
205 lines (170 loc) · 6.63 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
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
name: Build
on: push
env:
CARGO_TERM_COLOR: always
jobs:
build-webpack:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Use Yarn
run: npm install yarn -g
- name: Get Yarn cache directory path
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_ENV
- name: Cache Yarn dependencies
id: yarn-cache
uses: actions/cache@v3
with:
path: ${{ env.yarn_cache_dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Yarn dependencies
run: yarn install --prefer-offline
- name: Build app
run: yarn run build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: web
path: build/*
- name: Upload pages artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v1
with:
path: build
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: actions/deploy-pages@v1
- name: Compress release
if: startsWith(github.ref, 'refs/tags/v')
run: |
tar -zcvf "magenta-build.tar.gz" "build"
- name: Create release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: "magenta-build.tar.gz"
generate_release_notes: true
append_body: false
build-tauri:
needs: build-webpack
if: startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
permissions:
contents: write
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Use Yarn
run: npm install yarn -g
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libc6-dev libgtk-3-dev libwebkit2gtk-4.0-dev libglib2.0-dev libssl-dev librsvg2-dev libatk1.0-dev libappindicator3-dev libappindicator-dev libgdk3.0-cil libgdk3.0-cil
- name: Add Rust build targets (Windows)
if: runner.os == 'Windows'
run: |
rustup target add aarch64-pc-windows-msvc
rustup target add i686-pc-windows-msvc
rustup target add x86_64-pc-windows-msvc
- name: Add Rust build targets (Linux)
if: runner.os == 'Linux'
run: |
rustup target add x86_64-unknown-linux-gnu
- name: Add Rust build targets (macOS)
if: runner.os == 'macOS'
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
- name: Get Yarn cache directory path (Windows)
if: runner.os == 'Windows'
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $env:GITHUB_ENV
- name: Get Yarn cache directory path (non-Windows)
if: runner.os != 'Windows'
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_ENV
- name: Cache Yarn dependencies
id: yarn-cache
uses: actions/cache@v3
with:
path: ${{ env.yarn_cache_dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache Cargo dependencies
id: cargo-cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Yarn dependencies
run: yarn install --prefer-offline
- name: Download webpack artifact
uses: actions/download-artifact@v3
with:
name: web
path: build
- name: Build app
run: yarn run tauri:build
- name: Upload artifact (Windows, Setup)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v3
with:
name: win32-setup
path: "out/*-setup-*.exe"
- name: Upload artifact (Windows, MSI)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v3
with:
name: win32-msi
path: "out/*-setup-msi-*.msi"
- name: Upload artifact (Windows, Standalone)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v3
with:
name: win32-standalone
path: "out/*-standalone-*.exe"
- name: Upload artifact (Linux, Deb)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: linux-deb
path: "out/*.deb"
- name: Upload artifact (Linux, AppImage)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: linux-appimage
path: "out/*.AppImage"
- name: Upload artifact (macOS)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v3
with:
name: macos-dmg
path: "out/*.dmg"
- name: Create release
uses: softprops/action-gh-release@v1
with:
files: "out/*"
generate_release_notes: true
append_body: false