-
-
Notifications
You must be signed in to change notification settings - Fork 82
202 lines (179 loc) · 8.07 KB
/
electron_hash.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
name: Electron App Release
on:
push:
pull_request:
jobs:
# Release draft and share app version via package.json
pre_build:
runs-on: ubuntu-20.04
outputs:
output1: ${{ steps.release_drafter.outputs.upload_url }}
output2: ${{ steps.package-version.outputs.current-version }}
steps:
- name: Check out Git repository
if: startsWith(github.ref, 'refs/tags/')
uses: actions/checkout@v1
- name: Store NPM version
if: startsWith(github.ref, 'refs/tags/')
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- uses: release-drafter/release-drafter@v5
if: startsWith(github.ref, 'refs/tags/')
id: release_drafter
with:
name: ${{ steps.package-version.outputs.current-version }}
tag: v${{ steps.package-version.outputs.current-version }}
version: ${{ steps.package-version.outputs.current-version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
runs-on: ${{ matrix.os }}
# Run different jobs for each OS
strategy:
matrix:
include:
- os: ubuntu-20.04
artifact_name: checksums
asset_name: checksums
app_ext: AppImage
app_os: linux
- os: macos-11
artifact_name: checksums
asset_name: checksums
app_ext: dmg
app_os: mac
- os: windows-2022
artifact_name: checksums
asset_name: checksums
app_ext: exe
app_os: windows
needs: pre_build # job dependency and shared variables
steps:
- name: Check out Git repository
uses: actions/checkout@v1
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Install APT dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install build-essential git -y
sudo apt-get install libudev-dev -y
sudo apt-get install libusb-1.0-0-dev -y
- name: Install and Build Desktop App
run: |
npm install -g @angular/cli
npm install
npm run desktop:build
- name: Build Electron app
run: |
npm run desktop:local
- name: Create Hashes
if: startsWith(github.ref, 'refs/tags/')
run: |
openssl sha1 desktop-app/build/*.${{ matrix.app_ext }} >> desktop-app/build/${{ matrix.artifact_name }} | bash
openssl md5 desktop-app/build/*.${{ matrix.app_ext }} >> desktop-app/build/${{ matrix.artifact_name }} | bash
openssl sha256 desktop-app/build/*.${{ matrix.app_ext }} >> desktop-app/build/${{ matrix.artifact_name }} | bash
openssl sha512 desktop-app/build/*.${{ matrix.app_ext }} >> desktop-app/build/${{ matrix.artifact_name }} | bash
openssl sha3-512 desktop-app/build/*.${{ matrix.app_ext }} >> desktop-app/build/${{ matrix.artifact_name }} | bash
openssl blake2b512 desktop-app/build/*.${{ matrix.app_ext }} >> desktop-app/build/${{ matrix.artifact_name }} | bash
shell: bash
- name: Rename file paths in .yml (Linux)
if: matrix.os == 'ubuntu-20.04' && startsWith(github.ref, 'refs/tags/')
run: |
sed -i '/.AppImage/ s//-Linux.AppImage/g' desktop-app/build/latest-linux.yml | bash
shell: bash
# Special sed command for mac
- name: Rename file paths in .yml (Mac)
if: matrix.os == 'macos-11' && startsWith(github.ref, 'refs/tags/')
run: |
sed -i '' '/.dmg/ s//-Mac.dmg/g' desktop-app/build/latest-mac.yml
shell: bash
- name: Rename file paths in .yml (Windows)
if: matrix.os == 'windows-2022' && startsWith(github.ref, 'refs/tags/')
run: |
sed -i '/.exe/ s//-Windows.exe/g' desktop-app/build/latest.yml | bash
shell: bash
# Upload binaries separately for better control which release draft they go into
- name: Upload Binaries Linux
if: matrix.os == 'ubuntu-20.04' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.pre_build.outputs.output1 }} # This pulls ID from the Release Drafter step
asset_path: desktop-app/build/Nault-${{ needs.pre_build.outputs.output2 }}.${{ matrix.app_ext }}
asset_name: Nault-${{ needs.pre_build.outputs.output2 }}-Linux.${{ matrix.app_ext }}
asset_content_type: application/octet-stream
- name: Upload Binaries Mac
if: matrix.os == 'macos-11' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.pre_build.outputs.output1 }} # This pulls ID from the Release Drafter step
asset_path: desktop-app/build/Nault-${{ needs.pre_build.outputs.output2 }}.${{ matrix.app_ext }}
asset_name: Nault-${{ needs.pre_build.outputs.output2 }}-Mac.${{ matrix.app_ext }}
asset_content_type: application/octet-stream
- name: Upload Binaries Windows
if: matrix.os == 'windows-2022' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.pre_build.outputs.output1 }} # This pulls ID from the Release Drafter step
asset_path: desktop-app/build/Nault Setup ${{ needs.pre_build.outputs.output2 }}.${{ matrix.app_ext }}
asset_name: Nault-Setup-${{ needs.pre_build.outputs.output2 }}-Windows.${{ matrix.app_ext }}
asset_content_type: application/octet-stream
- name: Upload Checksums
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.pre_build.outputs.output1 }} # This pulls ID from the Release Drafter step
asset_path: desktop-app/build/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}-${{ needs.pre_build.outputs.output2}}-${{ matrix.app_os }}.txt
asset_content_type: application/octet-stream
- name: Upload yml Linux
if: matrix.os == 'ubuntu-20.04' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.pre_build.outputs.output1 }} # This pulls ID from the Release Drafter step
asset_path: desktop-app/build/latest-linux.yml
asset_name: latest-linux.yml
asset_content_type: application/octet-stream
- name: Upload yml Mac
if: matrix.os == 'macos-11' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.pre_build.outputs.output1 }} # This pulls ID from the Release Drafter step
asset_path: desktop-app/build/latest-mac.yml
asset_name: latest-mac.yml
asset_content_type: application/octet-stream
- name: Upload yml Windows
if: matrix.os == 'windows-2022' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.pre_build.outputs.output1 }} # This pulls ID from the Release Drafter step
asset_path: desktop-app/build/latest.yml
asset_name: latest.yml
asset_content_type: application/octet-stream
# Artifacts are always uploaded. Both untagged pushes and PRs
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}
path: |
desktop-app/build/*.AppImage
desktop-app/build/*.dmg
desktop-app/build/*.exe