-
Notifications
You must be signed in to change notification settings - Fork 22
232 lines (218 loc) · 8.14 KB
/
release.yml
File metadata and controls
232 lines (218 loc) · 8.14 KB
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# docs https://github.com/marketplace/actions/create-release
# docs https://github.com/ncipollo/release-action
# docs https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job#choosing-github-hosted-runners
name: release
on:
push:
tags:
- 'v*'
jobs:
linux:
strategy:
fail-fast: false
matrix:
arch: [x64, arm64]
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
# electron build
- uses: actions/checkout@v2
with:
# needed for git commit history changelog
fetch-depth: 0
- name: Setup Node.js v22
uses: actions/setup-node@v2
with:
node-version: 22
- name: Install dependencies (with Node v22)
run: yarn install --frozen-lockfile --ignore-engines
# make sure the ipfs executable is executable
- name: Download IPFS and set permissions (with Node v22)
run: node electron/download-ipfs && sudo chmod +x bin/linux/ipfs
- name: Build React app (with Node v22)
run: CI='' NODE_ENV=production yarn build
- name: Build Electron app for Linux (arm64)
if: ${{ matrix.arch == 'arm64' }}
run: yarn electron:build:linux:arm64
- name: Build Electron app for Linux (x64)
if: ${{ matrix.arch == 'x64' }}
run: yarn electron:build:linux:x64
- name: List dist directory
run: ls dist
# publish version release
- name: Generate release body
run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
artifacts: 'dist/seedit*.AppImage,dist/seedit*-arm64.AppImage,dist/seedit-html*.zip'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
omitBody: true
allowUpdates: true
mac:
strategy:
fail-fast: false
matrix:
include:
- runner: macos-15-intel # Intel x64
arch: x64
- runner: macos-latest # Apple Silicon arm64
arch: arm64
runs-on: ${{ matrix.runner }}
permissions:
contents: write
steps:
# electron build
- uses: actions/checkout@v2
with:
# needed for git commit history changelog
fetch-depth: 0
- name: Setup Node.js v22
uses: actions/setup-node@v2
with:
node-version: 22
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
# install missing dep for sqlite (use setup-python to avoid PEP 668 externally-managed-environment error)
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install setuptools
- name: Install dependencies (with Node v22)
run: yarn install --frozen-lockfile --ignore-engines
# make sure the ipfs executable is executable
- name: Download IPFS and set permissions (with Node v22)
run: node electron/download-ipfs && sudo chmod +x bin/mac/ipfs
- name: Build React app (with Node v22)
run: CI='' NODE_ENV=production yarn build
- name: Build Electron app for Mac (with Node v22)
env:
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
run: |
if [ "${{ matrix.arch }}" = "arm64" ]; then
yarn electron:build:mac:arm64
else
yarn electron:build:mac:x64
fi
- name: List dist directory
run: ls dist
# publish version release
- name: Generate release body
run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
artifacts: 'dist/seedit*.dmg,dist/seedit*-arm64.dmg'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
omitBody: true
allowUpdates: true
windows:
runs-on: windows-2022
permissions:
contents: write
steps:
# electron build
- uses: actions/checkout@v2
with:
# needed for git commit history changelog
fetch-depth: 0
- name: Setup Node.js v22
uses: actions/setup-node@v2
with:
node-version: 22
- name: Install dependencies (with Node v22) # --network-timeout and --network-concurrency are yarn v1 flags.
run: yarn install --frozen-lockfile --network-timeout 100000 --network-concurrency 1
- name: Build React app (with Node v22)
run: npx cross-env NODE_ENV=production yarn build
- name: Build Electron app for Windows (x64)
run: yarn electron:build:windows
- name: List dist directory
run: dir dist
# publish version release
- name: Generate release body
run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
artifacts: 'dist/seedit*.exe'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
omitBody: true
allowUpdates: true
android:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v2
with:
# needed to use 'git tag' and get all tags and for git commit history changelog
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.9
- uses: actions/setup-node@v2
with:
node-version: 22
- run: sudo apt install -y apksigner zipalign
# install all dependencies (including devDependencies needed for React build)
- name: Install dependencies (with Node v22)
run: yarn install --frozen-lockfile --ignore-engines
# build react app
- run: CI='' NODE_ENV=production yarn build
# set android versionCode and versionName
- run: sed -i "s/versionCode 1/versionCode $(git tag | wc -l)/" ./android/app/build.gradle
- run: sed -i "s/versionName \"1.0\"/versionName \"$(node -e "console.log(require('./package.json').version)")\"/" ./android/app/build.gradle
- run: cat ./android/app/build.gradle
# build apk
- run: npx cap sync android
- run: cd android && gradle bundle
- run: cd android && ./gradlew assembleRelease --stacktrace
# optimize apk
- run: cd android/app/build/outputs/apk/release && zipalign 4 app-release-unsigned.apk app-release-unsigned-zip.apk
# sign apk
# to create keystore: keytool -genkey -v -keystore plebbit.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias release
- run: cd android/app/build/outputs/apk/release && apksigner sign --ks ../../../../../plebbit.keystore --ks-pass pass:${{ secrets.PLEBBIT_REACT_KEYSTORE_PASSWORD }} --ks-key-alias release --out app-release-signed.apk app-release-unsigned-zip.apk
# move apk to dist folder
- run: mkdir -p dist && mv android/app/build/outputs/apk/release/app-release-signed.apk dist/seedit-$(node -e "console.log(require('./package.json').version)").apk
- run: ls dist
# publish version release
- run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
artifacts: 'dist/seedit*.apk'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
omitBody: true
allowUpdates: true
finalize-release:
runs-on: ubuntu-22.04
needs: [linux, mac, windows, android]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js v22
uses: actions/setup-node@v2
with:
node-version: 22
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-engines
- name: Generate final release body from GitHub assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF_NAME: ${{ github.ref_name }}
run: node scripts/release-body > release-body.txt
- name: Update release body only
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
bodyFile: "release-body.txt"