-
Notifications
You must be signed in to change notification settings - Fork 8
156 lines (143 loc) · 5.16 KB
/
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
# 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:
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
# electron build
- uses: actions/checkout@v2
with:
# needed for git commit history changelog
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 18
- run: yarn install --frozen-lockfile
# make sure the ipfs executable is executable
- run: node electron/download-ipfs && sudo chmod +x bin/linux/ipfs
- run: CI='' yarn build
- run: yarn electron:build:linux
- run: ls dist
# publish version release
- run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
artifacts: 'dist/plebchan*.AppImage,dist/plebchan-html*.zip'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
allowUpdates: true
mac:
runs-on: macOS-13
permissions:
contents: write
steps:
# electron build
- uses: actions/checkout@v2
with:
# needed for git commit history changelog
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 18
# install missing dep for sqlite
- run: python3 -m ensurepip
- run: pip install setuptools
- run: yarn install --frozen-lockfile
# make sure the ipfs executable is executable
- run: node electron/download-ipfs && sudo chmod +x bin/mac/ipfs
- run: CI='' yarn build
- run: yarn electron:build:mac
- run: ls dist
# publish version release
- run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
artifacts: 'dist/plebchan*.dmg'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
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
- uses: actions/setup-node@v2
with:
node-version: 18
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn electron:build:windows
- run: dir dist
# publish version release
- run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
artifacts: 'dist/plebchan*.exe'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
allowUpdates: true
android:
runs-on: ubuntu-20.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: 7.6
- uses: actions/setup-node@v2
with:
node-version: 18
- 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 && gradle 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/plebchan-$(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/plebchan*.apk'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
allowUpdates: true