-
Notifications
You must be signed in to change notification settings - Fork 3
209 lines (193 loc) · 7.64 KB
/
Copy pathrelease.yml
File metadata and controls
209 lines (193 loc) · 7.64 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
# 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:
workflow_run:
workflows: ["CI Release"]
types: ["completed"]
jobs:
linux:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04
timeout-minutes: 60
permissions:
contents: write
steps:
# electron build
- uses: actions/checkout@v4
with:
# needed for git commit history changelog
fetch-depth: 0
- name: Get latest release tag
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install squashfs-tools for AppImage
run: sudo apt-get update && sudo apt-get install -y squashfs-tools
- run: yarn install --frozen-lockfile
- run: yarn electron:make:linux
- run: ls -la out/make/AppImage/x64/
# verify executable works
- name: Install xvfb
run: sudo apt-get install -y xvfb
- name: Verify AppImage executable
run: |
chmod +x out/make/AppImage/x64/plebones-*.AppImage
xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" \
node scripts/verify-executable.js "$(ls out/make/AppImage/x64/plebones-*.AppImage | head -1)"
timeout-minutes: 5
# publish version release
- run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
tag: ${{ steps.previoustag.outputs.tag }}
artifacts: 'out/make/AppImage/x64/plebones*.AppImage,out/make/plebones-html-*.zip'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
allowUpdates: true
mac:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: macos-14
timeout-minutes: 60
permissions:
contents: write
steps:
# electron build
- uses: actions/checkout@v4
with:
# needed for git commit history changelog
fetch-depth: 0
- name: Get latest release tag
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: actions/setup-python@v5
with:
python-version: '3.12'
# install missing dep for sqlite
- run: pip install setuptools
- run: yarn install --frozen-lockfile
- run: yarn electron:make:mac
- run: ls -la out/make/
# verify executable works
- name: Verify macOS executable
run: |
DMG_FILE=$(ls out/make/*.dmg | head -1)
hdiutil attach "$DMG_FILE" -nobrowse -quiet
APP_PATH="/Volumes/plebones/plebones.app/Contents/MacOS/plebones"
node scripts/verify-executable.js "$APP_PATH" || EXIT_CODE=$?
hdiutil detach "/Volumes/plebones" -quiet || true
exit ${EXIT_CODE:-0}
timeout-minutes: 5
# publish version release
- run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
tag: ${{ steps.previoustag.outputs.tag }}
artifacts: 'out/make/*.dmg'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
allowUpdates: true
windows:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: windows-2022
timeout-minutes: 60
permissions:
contents: write
steps:
# electron build
- uses: actions/checkout@v4
with:
# needed for git commit history changelog
fetch-depth: 0
- name: Get latest release tag
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
- uses: actions/setup-node@v4
with:
node-version: 22
- run: yarn install --frozen-lockfile
- run: yarn electron:make:windows
- run: Get-ChildItem -Path out/make -Recurse
shell: pwsh
# verify executable works
- name: Verify Windows executable
run: |
$exePath = Get-ChildItem -Path "out/make/squirrel.windows/x64" -Filter "*.exe" | Where-Object { $_.Name -notmatch "Setup" } | Select-Object -First 1 -ExpandProperty FullName
if (-not $exePath) {
# Fall back to Setup.exe if no other exe found
$exePath = Get-ChildItem -Path "out/make/squirrel.windows/x64" -Filter "*Setup*.exe" | Select-Object -First 1 -ExpandProperty FullName
}
node scripts/verify-executable.js $exePath
timeout-minutes: 5
shell: pwsh
# publish version release
- run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
tag: ${{ steps.previoustag.outputs.tag }}
artifacts: 'out/make/squirrel.windows/x64/*.exe,out/make/zip/win32/x64/*.zip'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
allowUpdates: true
android:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04
timeout-minutes: 60
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
# needed to use 'git tag' and get all tags and for git commit history changelog
fetch-depth: 0
- name: Get latest release tag
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- uses: gradle/actions/setup-gradle@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: sudo apt install -y apksigner zipalign
# build react app
- run: yarn install --frozen-lockfile
- run: CI='' 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 update
- run: npx cap copy
- run: cd android && ./gradlew bundle
- run: cd android && ./gradlew assembleRelease
# 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/plebones-$(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:
tag: ${{ steps.previoustag.outputs.tag }}
artifacts: 'dist/plebones*.apk'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
allowUpdates: true