-
-
Notifications
You must be signed in to change notification settings - Fork 23
195 lines (163 loc) · 5.29 KB
/
build-and-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
name: Build and release
on:
push:
branches: [ main ]
tags:
- 'v*'
paths-ignore:
- 'README.md'
- 'CHANGE.md'
- 'doc/*'
- '.github/*'
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Npm Install
run: npm install
- name: Build Dist
env:
NODE_ENV: production
NODE_OPTIONS: --max_old_space_size=4096
run: npm run dist
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: OpenBlockLink-win-x64.exe
path: dist/OpenBlock*Setup.exe
retention-days: 1
build-windows32:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Npm Install
run: npm install
- name: Build Dist
env:
NODE_ENV: production
NODE_OPTIONS: --max_old_space_size=4096
run: npm run dist32
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: OpenBlockLink-win-x86.exe
path: dist/OpenBlock*Setup.exe
retention-days: 1
build-mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Npm Install
run: npm install
- name: Build Dist
env:
NODE_ENV: production
NODE_OPTIONS: --max_old_space_size=8192
CSC_IDENTITY_AUTO_DISCOVERY: false
run: npm run dist
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: OpenBlockLink-mac.dmg
path: dist/OpenBlock*.dmg
retention-days: 1
create-release:
needs: [build-windows, build-windows32, build-mac]
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.tag }}
release_name: OpenBlock Link ${{ steps.tag.outputs.tag }}
body: |
- **New feature**
1. First Change
2. Second Change
- **Fix bug**
1. First Change
2. Second Change
draft: true
prerelease: false
- name: Download all build result
uses: actions/download-artifact@v2
# Windows x64 Release
- name: Zip win x64 file
uses: papeloto/action-zip@v1
with:
files: OpenBlockLink-win-x64.exe
dest: OpenBlockLink-win-x64.zip
- name: Relase Windows x64 package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./OpenBlockLink-win-x64.zip
asset_name: OpenBlockLink-${{ steps.package-version.outputs.current-version }}-win-x64.zip
asset_content_type: application/zip
# Windows x86 Release
- name: Zip win x86 file
uses: papeloto/action-zip@v1
with:
files: OpenBlockLink-win-x86.exe
dest: OpenBlockLink-win-x86.zip
- name: Relase Windows x64 package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./OpenBlockLink-win-x86.zip
asset_name: OpenBlockLink-${{ steps.package-version.outputs.current-version }}-win-x86.zip
asset_content_type: application/zip
# Mac Release
- name: Zip mac file
uses: papeloto/action-zip@v1
with:
files: OpenBlockLink-mac.dmg
dest: OpenBlockLink-mac.zip
- name: Relase Mac package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./OpenBlockLink-mac.zip
asset_name: OpenBlockLink-${{ steps.package-version.outputs.current-version }}-mac.zip
asset_content_type: application/zip
# Checksum Release
- name: Checksum
run: sha256sum OpenBlockLink-*.zip >> checksums.txt
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: checksums.txt
asset_name: ${{ steps.package-version.outputs.current-version }}-checksums-sha256.txt
asset_content_type: application/zip