-
Notifications
You must be signed in to change notification settings - Fork 71
216 lines (182 loc) · 6.85 KB
/
publish-version.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
215
216
name: Publish version
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ${{ matrix.os }}
env:
STX_NETWORK: ${{ matrix.stx_network }}
strategy:
matrix:
os: [macos-11, ubuntu-20.04, windows-latest]
stx_network: [testnet, mainnet]
include:
- os: macos-11
UPLOAD_ASSETS: release/**/*.dmg
NPM_COMMAND: mac
CSC_LINK_SECRET_NAME: CODE_SIGNING_CERTIFICATE_APPLE
CSC_KEY_PASSWORD_SECRET_NAME: CODE_SIGNING_PASSWORD_APPLE
- os: ubuntu-20.04
NPM_COMMAND: linux
UPLOAD_ASSETS: |
release/**/*.deb
release/**/*.rpm
- os: windows-latest
NPM_COMMAND: win
UPLOAD_ASSETS: release/**/*.exe
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/package.json') }}-${{ secrets.CACHE_BUSTER }}
- name: Add required Linux dependencies
uses: ./.github/actions/linux-deps
if: matrix.os == 'ubuntu-20.04'
- name: Variables
id: vars
run: |
echo "::set-output name=branch_name::$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=pull_request_id::$(echo $GITHUB_REF)"
- name: Install code-signing certs - Apple only
uses: apple-actions/import-codesign-certs@v1
if: matrix.os == 'macos-11'
with:
p12-file-base64: ${{ secrets.CODE_SIGNING_CERTIFICATE_APPLE }}
p12-password: ${{ secrets.CODE_SIGNING_PASSWORD_APPLE }}
- uses: actions/setup-node@v3
with:
node-version: 18
#
# Windows build breaks when using the package.json script to install `app/` packages
# using separate run to install those packages separately
- name: Install packages
uses: nick-invision/retry@v2
with:
timeout_seconds: 600
max_attempts: 3
retry_on: error
command: yarn --frozen-lockfile --ignore-scripts
- name: Install `app/` packages
run: cd app && yarn --frozen-lockfile --ignore-scripts
- name: Install `concat-map` - Windows only
run: yarn add concat-map --ignore-scripts --frozen-lockfile
if: matrix.os == 'windows-latest'
- name: Build releases
if: matrix.os == 'macos-11'
run: ./node_modules/.bin/cross-env yarn package-${{ matrix.NPM_COMMAND }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_ENV: production
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }}
CSC_LINK: ${{ secrets[matrix.CSC_LINK_SECRET_NAME] }}
CSC_KEY_PASSWORD: ${{ secrets[matrix.CSC_KEY_PASSWORD_SECRET_NAME] }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }}
- name: Build releases
if: matrix.os != 'macos-11'
run: ./node_modules/.bin/cross-env yarn package-${{ matrix.NPM_COMMAND }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_ENV: production
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }}
- uses: actions/upload-artifact@v2
name: ${{ matrix.os }} upload
with:
name: leather-wallet-${{ matrix.stx_network }}-${{ matrix.NPM_COMMAND }}
path: ${{ matrix.UPLOAD_ASSETS }}
create-release:
runs-on: ubuntu-20.04
needs:
- build
outputs:
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
new_version: ${{ steps.extract_version.outputs.version }}
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
- name: Extract version
id: extract_version
uses: Saionaro/[email protected]
- name: Download binaries
uses: actions/download-artifact@v2
with:
path: release
- name: Move binaries to root directory
run: mv release/*/leather-wallet* .
- name: Download release-notes.txt from create-version workflow
uses: dawidd6/action-download-artifact@v2
with:
workflow: create-version.yml
name: release-notes
- name: Import GPG key
id: import_gpg_key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Prepare release notes
run: |
sed -i '1d' release-notes.txt
echo "\`\`\`" >> release-notes.txt
shasum -a 256 leather-wallet* >> shasums.txt
gpg --armor --output shasums.txt.asc --clearsign --digest-algo SHA256 shasums.txt
cat release-notes.txt shasums.txt.asc > release-body.txt
echo "\`\`\`" >> release-body.txt
- run: echo ${{ steps.extract_version.outputs.version }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
# check for case where it hasn't found version number
if: steps.extract_version.outputs.version != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.extract_version.outputs.version }}
release_name: Leather v${{ steps.extract_version.outputs.version }}
draft: false
prerelease: ${{ contains(steps.extract_version.outputs.version, 'dev') }}
body_path: release-body.txt
upload-release-assets:
runs-on: ubuntu-20.04
needs:
- build
- create-release
strategy:
max-parallel: 2
matrix:
stx_network: [testnet, mainnet]
ext: [dmg, exe, deb, rpm]
include:
- ext: dmg
os: mac
- ext: exe
os: win
- ext: rpm
os: linux
- ext: deb
os: linux
steps:
- name: Download binaries
uses: actions/download-artifact@v2
with:
path: release
- run: ls -R release
- name: Upload Release Asset .${{ matrix.ext }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
asset_path: release/leather-wallet-${{ matrix.stx_network }}-${{ matrix.os }}/leather-wallet.${{ matrix.stx_network }}.${{ matrix.ext }}
asset_name: leather-wallet.${{ matrix.stx_network }}.v${{ needs.create-release.outputs.new_version }}.${{ matrix.ext }}
asset_content_type: application/octet-stream