-
-
Notifications
You must be signed in to change notification settings - Fork 24
202 lines (184 loc) · 7.25 KB
/
Preview.yaml
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: Preview CI
on:
# Manual triggers
workflow_dispatch:
inputs:
git-ref:
description: Git Ref (Optional)
required: false
dry-run:
description: Creates a draft release
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
BuildBinaries:
name: Build application packages
strategy:
matrix:
runtime: [ linux-x64, win-x64, android ]
include:
- runtime: linux-x64
arch: x64
os: ubuntu-latest
shell: bash
build: :desktop:packageUberJarForCurrentOS :desktop:packageDeb
setupCl: ./.github/scripts/SetupClUnix.sh
- runtime: win-x64
arch: x64
os: windows-latest
shell: powershell
build: :desktop:packageUberJarForCurrentOS :desktop:packageMsi
setupCl: ./.github/scripts/SetupClWindows.ps1
- runtime: android
arch: x64
os: ubuntu-latest
shell: bash
build: :android:assembleStandardRelease
setupCl: ./.github/scripts/SetupClUnix.sh
runs-on: ${{ matrix.os }}
timeout-minutes: 60
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Clone Repository (Latest)
uses: actions/checkout@v3
with:
repository: 'ireaderorg/ireader'
fetch-depth: 0
if: github.event.inputs.git-ref == ''
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v3
if: github.event.inputs.git-ref != ''
with:
repository: 'ireaderorg/ireader'
fetch-depth: 0
ref: ${{ github.event.inputs.git-ref }}
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: adopt
- name: Get previous release
id: last_release
uses: InsonusK/[email protected]
with:
myToken: ${{ github.token }}
exclude_types: "draft|prerelease"
view_top: 1
- uses: actions/setup-java@v3
if: ${{ matrix.runtime != 'linux-fedora-x64' }}
with:
java-version: 17
distribution: adopt
architecture: ${{ matrix.arch }}
- name: Setup Cl
run: ${{ matrix.setupCl }}
- name: Set commit count
shell: bash
run: |
commit_count=$(git rev-list --count HEAD)
echo "COMMIT_COUNT=$commit_count" >> $GITHUB_ENV
- name: Build rpm Package
if: ${{ matrix.runtime == 'linux-fedora-x64' }}
uses: Syer10/Fedora-Java17-Action@v1
with:
command: ./gradlew ${{ matrix.build }} -Ppreview="${{ env.COMMIT_COUNT }}" --stacktrace
- name: Build
if: ${{ matrix.runtime != 'linux-fedora-x64' }}
uses: gradle/gradle-build-action@v2
with:
arguments: >
${{ matrix.build }}
- name: Sign APK
uses: r0adkll/sign-android-release@v1
if: ${{ matrix.runtime == 'android' }}
with:
releaseDirectory: android/build/outputs/apk/standard/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
# Upload runner package tar.gz/zip as artifact
- name: Publish Artifact
uses: actions/upload-artifact@v3
with:
name: runner-package-${{ matrix.runtime }}
path: |
desktop/build/compose/binaries/main/*/
desktop/build/compose/jars/
!desktop/build/compose/binaries/main/app/
- name: Publish Android Artifact
if: ${{ matrix.runtime == 'android' }}
uses: actions/upload-artifact@v3
with:
name: runner-package-${{ matrix.runtime }}
path: |
android/build/outputs/apk/standard/release/android-standard-universal-release-unsigned-signed.apk
android/build/outputs/apk/standard/release/android-standard-arm64-v8a-release-unsigned-signed.apk
android/build/outputs/apk/standard/release/android-standard-armeabi-v7a-release-unsigned-signed.apk
android/build/outputs/apk/standard/release/android-standard-x86-release-unsigned-signed.apk
android/build/outputs/apk/standard/release/android-standard-x86_64-release-unsigned-signed.apk
# Upload runner errors
- name: Upload error logs
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: runner-errors-${{ matrix.runtime }}
path: |
desktop/build/compose/logs/
ReleaseBinaries:
name: Make a release
needs: [ BuildBinaries ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download Build Artifacts
uses: actions/download-artifact@v3
- name: Fix deb java dependency
run: ./.github/scripts/DebDependencyFix.sh
- name: Prepare build
run: |
set -e
commit_count=$(git rev-list --count HEAD)
echo "COMMIT_COUNT=$commit_count" >> $GITHUB_ENV
current_sha=$(git rev-parse --short HEAD)
echo "CURRENT_SHA=$current_sha" >> $GITHUB_ENV
echo last_tag=${{ steps.last_release.outputs.tag_name }}
prev_commit_count=$(echo "${last_tag}" | sed -e "s/^r//")
commit_count_diff=$(($commit_count - $prev_commit_count))
prev_release_sha=$(git rev-parse --short HEAD~$commit_count_diff)
echo "PREV_RELEASE_SHA=$prev_release_sha" >> $GITHUB_ENV
echo "COMMIT_LOGS<<{delimiter}
$(curl -H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/ireaderorg/ireader/compare/$prev_release_sha...$current_sha" \
| jq '[.commits[]|{message:(.commit.message | split("\n")), username:.author.login}]' \
| jq -r '.[]|"- \(.message | first) (@\(.username))"')
{delimiter}" >> $GITHUB_ENV
mkdir -p ~/.android/ && echo "${{ secrets.DEBUG_KEYSTORE }}" | base64 --decode > ~/.android/debug.keystore
- uses: ncipollo/[email protected]
with:
artifacts: "*/binaries/main/*/*.*,*/jars/*.jar,*/android-standard-universal-release-unsigned-signed.apk,*/android-standard-arm64-v8a-release-unsigned-signed.apk,*/android-standard-armeabi-v7a-release-unsigned-signed.apk,*/android-standard-x86-release-unsigned-signed.apk,*/android-standard-x86_64-release-unsigned-signed.apk"
allowUpdates: true
token: ${{ secrets.WINGET_PUBLISH_PAT }}
tag: r${{ env.COMMIT_COUNT }}
repo: IReader-Preview
name: IReader Preview r${{ env.COMMIT_COUNT }}
body: |
### Commits
https://github.com/ireaderorg/ireader/compare/${{ env.PREV_RELEASE_SHA }}...${{ env.CURRENT_SHA }}
${{ env.COMMIT_LOGS }}
- name: Prune old releases
uses: dev-drprasad/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.WINGET_PUBLISH_PAT }}
with:
keep_latest: 15
delete_tags: true
repo: IReaderorg/IReader-Preview