-
Notifications
You must be signed in to change notification settings - Fork 1
214 lines (180 loc) · 5.97 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
206
207
208
209
210
211
212
213
214
name: Build and Release
on:
workflow_dispatch:
jobs:
build_windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache npm
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-cache
restore-keys: |
${{ runner.os }}-npm-cache
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.x'
- name: Install dependencies
run: npm install
- name: Build for Windows
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run dist -- --win
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: windows-dist
path: dist/
build_linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache npm
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-cache
restore-keys: |
${{ runner.os }}-npm-cache
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.x'
- name: Install dependencies
run: npm install
- name: Build for Linux
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run dist -- --linux
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: linux-dist
path: dist/
build_mac:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache npm
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-cache
restore-keys: |
${{ runner.os }}-npm-cache
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.x'
- name: Install dependencies
run: npm install
- name: Build for Mac
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run dist -- --mac
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: mac-dist
path: dist/
create_release:
runs-on: ubuntu-latest
needs: [build_windows, build_linux, build_mac]
if: ${{ success() }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download Windows artifact
uses: actions/download-artifact@v2
with:
name: windows-dist
path: ./dist/
- name: Download Linux artifact
uses: actions/download-artifact@v2
with:
name: linux-dist
path: ./dist/
- name: Download Mac artifact
uses: actions/download-artifact@v2
with:
name: mac-dist
path: ./dist/
- name: Unzip Windows artifact
run: unzip ./dist/windows_dist.zip -d ./dist/windows/
- name: Unzip Linux artifact
run: unzip ./dist/linux_dist.zip -d ./dist/linux/
- name: Unzip Mac artifact
run: unzip ./dist/mac_dist.zip -d ./dist/mac/
- name: Read package.json version
id: get_version
run: echo "::set-output name=version::$(jq -r .version package.json)"
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: Release v${{ steps.get_version.outputs.version }}
draft: false
prerelease: false
- name: Upload Release Asset (Windows Setup)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/windows/ExcalidrawElectron\ Setup\ ${{ steps.get_version.outputs.version }}.exe
asset_name: ExcalidrawElectron_Setup_${{ steps.get_version.outputs.version }}.exe
asset_content_type: application/octet-stream
- name: Upload Release Asset (Windows Executable)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/windows/ExcalidrawElectron\ ${{ steps.get_version.outputs.version }}.exe
asset_name: ExcalidrawElectron_${{ steps.get_version.outputs.version }}.exe
asset_content_type: application/octet-stream
- name: Upload Release Asset (Linux)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/linux/*.AppImage
asset_name: ExcalidrawElectron_${{ steps.get_version.outputs.version }}.AppImage
asset_content_type: application/octet-stream
- name: Upload Release Asset (Linux Deb)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/linux/*.deb
asset_name: ExcalidrawElectron_${{ steps.get_version.outputs.version }}.deb
asset_content_type: application/vnd.debian.binary-package
- name: Upload Release Asset (Mac App)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/mac/*.dmg
asset_name: ExcalidrawElectron_${{ steps.get_version.outputs.version }}.dmg
asset_content_type: application/octet-stream
- name: Upload Release Asset (Mac Zip)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/mac/*.zip
asset_name: ExcalidrawElectron_${{ steps.get_version.outputs.version }}.zip
asset_content_type: application/zip