-
-
Notifications
You must be signed in to change notification settings - Fork 28
167 lines (143 loc) · 6.22 KB
/
build.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
name: Build signed app
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- v*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build app
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [Rootless, Root]
steps:
- id: flavor
uses: ASzc/change-string-case-action@v5
with:
string: ${{ matrix.flavor }}
- name: Install packages
run: |
sudo apt update
sudo apt install rename
- name: Clone repo
uses: actions/checkout@v3
with:
submodules: true
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: adopt
- name: Build release app
if: startsWith(github.ref, 'refs/tags/')
uses: gradle/gradle-command-action@v2
with:
arguments: assemble${{ matrix.flavor }}FullRelease
- name: Build preview app
if: "!startsWith(github.ref, 'refs/tags/')"
uses: gradle/gradle-command-action@v2
with:
arguments: assemble${{ matrix.flavor }}FullPreview
- name: Declare preview build type
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
set -x
echo "BUILD_TYPE=preview" >> $GITHUB_ENV
- name: Declare release build type
if: startsWith(github.ref, 'refs/tags/')
run: |
set -x
echo "BUILD_TYPE=release" >> $GITHUB_ENV
- name: Get tag name
if: startsWith(github.ref, 'refs/tags/')
run: |
set -x
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Sign APKs
uses: ilharp/[email protected]
with:
releaseDir: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}
signingKey: ${{ secrets.SIGNING_KEYSTORE }}
keyAlias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Rename build artifacts
run: |
set -e
ls -l app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}
rename -v 's/-unsigned-signed//g' app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*.apk
rm -f app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*unsigned*.apk || true
ls -l app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}
- name: Upload build artifact (universal)
uses: actions/[email protected]
with:
name: "${{ matrix.flavor }}JamesDSP-universal-preview_apk"
path: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*universal-${{ env.BUILD_TYPE }}-signed.apk
- name: Upload build artifact (x86)
uses: actions/[email protected]
with:
name: "${{ matrix.flavor }}JamesDSP-x86-preview_apk"
path: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*x86-${{ env.BUILD_TYPE }}-signed.apk
- name: Upload build artifact (x86_64)
uses: actions/[email protected]
with:
name: "${{ matrix.flavor }}JamesDSP-x86_64-preview_apk"
path: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*x86_64-${{ env.BUILD_TYPE }}-signed.apk
- name: Upload build artifact (armeabi-v7a)
uses: actions/[email protected]
with:
name: "${{ matrix.flavor }}JamesDSP-armeabi-v7a-preview_apk"
path: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*armeabi-v7a-${{ env.BUILD_TYPE }}-signed.apk
- name: Upload build artifact (arm64-v8a)
uses: actions/[email protected]
with:
name: "${{ matrix.flavor }}JamesDSP-arm64-v8a-preview_apk"
path: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*arm64-v8a-${{ env.BUILD_TYPE }}-signed.apk
- name: Deploy root flavor APKs to the server
if: ${{ steps.flavor.outputs.lowercase == 'root' && startsWith(github.ref, 'refs/tags/') && github.repository == 'ThePBone/RootlessJamesDSP' }}
uses: wlixcc/[email protected]
with:
username: 'tim'
server: 'srv1.timschneeberger.me'
ssh_private_key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
local_path: "app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*universal-${{ env.BUILD_TYPE }}-signed.apk"
remote_path: '/srv/http/nightly.timschneeberger.me/rootlessjamesdsp-rootfull'
sftpArgs: '-o ConnectTimeout=5'
- name: Changelog
if: startsWith(github.ref, 'refs/tags/')
uses: ardalanamini/auto-changelog@v3
id: changelog
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
release-name: ${{ env.VERSION_TAG }}
mention-authors: false
mention-new-contributors: false
include-compare: true
- name: Read changelog template
id: changelog_post
uses: andstor/file-reader-action@v1
with:
path: ".github/CHANGELOG_POSTFIX.md"
- name: Create Release
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'ThePBone/RootlessJamesDSP'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION_TAG }}
name: RootlessJamesDSP ${{ env.VERSION_TAG }}
body: "${{ steps.changelog.outputs.changelog }}   ${{ steps.changelog_post.outputs.contents }}"
#files: |
# app/build/outputs/apk/rootlessFull/${{ env.BUILD_TYPE }}/*-signed.apk
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}