forked from MaintainTeam/LastPipeBender
-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (146 loc) · 7.18 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Release
on:
workflow_dispatch:
inputs:
title:
type: string
description: 'Title'
required: true
default: 'v0.00.0 R0'
# pre-release is default anymore !
# is_pre_release:
# type: boolean
# description: 'Set as a pre-release'
# required: true
# default: true
style:
type: integer
description: '1: master only, 2: extended only, 3: both master&extended, 4: only selected branch'
required: true
default: 3
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Create proper environment for multiple apk output
run: |
apt install rename
mkdir -p "${{ github.workspace }}/output"
if [[ "${{ inputs.style }}" -eq "1" ]]; then
mkdir -p "${{ github.workspace }}/master"
elif [[ "${{ inputs.style }}" -eq "2" ]]; then
mkdir -p "${{ github.workspace }}/extended"
elif [[ "${{ inputs.style }}" -eq "3" ]]; then
# mkdir -p "${{ github.workspace }}/{master,extended}" # REVIEW not working, why?
mkdir -p "${{ github.workspace }}/master"
mkdir -p "${{ github.workspace }}/extended"
else
mkdir -p "${{ github.workspace }}/current"
fi
ls -la
- name: Checkout all selected branches
env:
BRANCH: ${{ github.ref_name }}
run: |
if [[ "${{ inputs.style }}" -eq "1" ]]; then
cd "${{ github.workspace }}/master"
git clone --no-checkout https://github.com/MaintainTeam/LastPipeBender.git .
git config core.symlinks false
git checkout --progress --force "master"
elif [[ "${{ inputs.style }}" -eq "2" ]]; then
cd "${{ github.workspace }}/extended"
git clone --no-checkout https://github.com/MaintainTeam/LastPipeBender.git .
git config core.symlinks false
git checkout --progress --force "extended"
elif [[ "${{ inputs.style }}" -eq "3" ]]; then
cd "${{ github.workspace }}/master"
git clone --no-checkout https://github.com/MaintainTeam/LastPipeBender.git .
git config core.symlinks false
git checkout --progress --force "master"
cd "${{ github.workspace }}/extended"
git clone --no-checkout https://github.com/MaintainTeam/LastPipeBender.git .
git config core.symlinks false
git checkout --progress --force "extended"
else
cd "${{ github.workspace }}/current"
git clone --no-checkout https://github.com/MaintainTeam/LastPipeBender.git .
git config core.symlinks false
git checkout --progress --force "$BRANCH"
fi
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "temurin"
cache: 'gradle'
- name: Build release APK
run: |
if [[ "${{ inputs.style }}" -eq "1" ]]; then
cd "${{ github.workspace }}/master"
echo "::notice::building master"
./gradlew assembleRelease
mv "${{ github.workspace }}/master/app/build/outputs/apk/release/app-release-unsigned.apk" "${{ github.workspace }}/output/master.apk"
elif [[ "${{ inputs.style }}" -eq "2" ]]; then
cd "${{ github.workspace }}/extended/"
echo "::notice::building extended"
./gradlew assembleRelease
mv "${{ github.workspace }}/extended/app/build/outputs/apk/release/app-release-unsigned.apk" "${{ github.workspace }}/output/extended.apk"
elif [[ "${{ inputs.style }}" -eq "3" ]]; then
echo "::notice::both master and extended are going to build"
cd "${{ github.workspace }}/master"
echo "::notice::building master"
./gradlew assembleRelease
mv "${{ github.workspace }}/master/app/build/outputs/apk/release/app-release-unsigned.apk" "${{ github.workspace }}/output/master.apk"
cd "${{ github.workspace }}/extended"
echo "::notice::building extended"
./gradlew assembleRelease
mv "${{ github.workspace }}/extended/app/build/outputs/apk/release/app-release-unsigned.apk" "${{ github.workspace }}/output/extended.apk"
else
cd "${{ github.workspace }}/current"
echo "::notice::building current"
./gradlew assembleRelease
mv "${{ github.workspace }}/current/app/build/outputs/apk/release/app-release-unsigned.apk" "${{ github.workspace }}/output/current.apk"
fi
- name: Sign APK
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
run: |
cd "${{ github.workspace }}/output/"
echo "${KEYSTORE}" | base64 -d > apksign.keystore
if [[ "${{ inputs.style }}" -eq "1" ]]; then
version=$( grep "versionName" "${{ github.workspace }}/master/app/build.gradle" | awk -F'"' '{print $2}' )
${ANDROID_HOME}/build-tools/34.0.0/apksigner sign --ks apksign.keystore --ks-pass env:SIGNING_STORE_PASSWORD "./master.apk"
elif [[ "${{ inputs.style }}" -eq "2" ]]; then
version=$( grep "versionName" "${{ github.workspace }}/extended/app/build.gradle" | awk -F'"' '{print $2}' )
${ANDROID_HOME}/build-tools/34.0.0/apksigner sign --ks apksign.keystore --ks-pass env:SIGNING_STORE_PASSWORD "./extended.apk"
elif [[ "${{ inputs.style }}" -eq "3" ]]; then
version=$( grep "versionName" "${{ github.workspace }}/master/app/build.gradle" | awk -F'"' '{print $2}' ) # Use version of master app while both released !
${ANDROID_HOME}/build-tools/34.0.0/apksigner sign --ks apksign.keystore --ks-pass env:SIGNING_STORE_PASSWORD "./master.apk"
${ANDROID_HOME}/build-tools/34.0.0/apksigner sign --ks apksign.keystore --ks-pass env:SIGNING_STORE_PASSWORD "./extended.apk"
else
mkdir "${{ github.workspace }}/current"
version=$( grep "versionName" "${{ github.workspace }}/current/app/build.gradle" | awk -F'"' '{print $2}' )
${ANDROID_HOME}/build-tools/34.0.0/apksigner sign --ks apksign.keystore --ks-pass env:SIGNING_STORE_PASSWORD "./current.apk"
fi
rename "master" "pipebender_v${version}"
rename "extended" "pipebender_v${version}-e"
rename "current" "pipebender_v${version}"
ls -la
- name: Generate checksum
run: |
cd "${{ github.workspace }}/output/"
sha256sum *.apk > ./checksums.txt
echo "::notice::$(cat ./checksums.txt)"
- name: Create release and upload
run: |
gh auth login --with-token <<<"${{ secrets.GITHUB_TOKEN }}"
gh release create "v${version}" --title "${{ inputs.title }}" --notes-file ".github/changelog.md" --prerelease="true" --repo MaintainTeam/LastPipeBender
gh release upload "v${version}" "${{ github.workspace }}/output/{*.apk,checksums.txt}" --repo MaintainTeam/LastPipeBender
- name: Archive reports for job
uses: actions/upload-artifact@v4
with:
name: reports
path: '*/build/reports'
if: ${{ always() }}