-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (99 loc) · 3.86 KB
/
backup.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
name: Non-update Builds
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-22.04
outputs:
new_tag: ${{ steps.tagger.outputs.new_tag }}
steps:
- uses: actions/checkout@v3
with:
ref: base
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Setup Android SDK 💻
uses: android-actions/setup-android@v3
with:
android_sdk_version: '35.0.0'
android_build_tools_version: '35.0.0'
- name: Pull upstream 🌏
run: |
git remote add upstream https://github.com/KotatsuApp/Kotatsu-Nightly.git
git fetch upstream base
git reset --hard upstream/base
- name: Grant permissions 💻
run: chmod a+x gradlew
- name: Generate build number 📆
id: tagger
run: |
echo "new_tag=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
echo "formatted_date=$(date +'%Y/%m/%d')" >> $GITHUB_OUTPUT
- name: Building new APK 💻
run: >-
./gradlew assembleNightly
-DparsersVersionOverride=$(curl -s https://api.github.com/repos/kotatsuapp/kotatsu-parsers/commits/master -H "Accept: application/vnd.github.sha" | cut -c -10)
- name: Packaging new APK 💻
uses: ilharp/sign-android-release@v1
id: sign_app
with:
releaseDir: app/build/outputs/apk/nightly
signingKey: ${{ secrets.ANDROID_SIGNING_KEY }}
keyAlias: ${{ secrets.ANDROID_KEY_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
buildToolsVersion: 35.0.0
- name: Prepare to Upload 🌏
run: |
mv ${{steps.sign_app.outputs.signedFile}} app/build/outputs/apk/nightly/release.apk
echo "SIGNED_APK=app/build/outputs/apk/nightly/release.apk" >> $GITHUB_ENV
- name: Get latest changes 📑
id: changelog
run: |
CHANGELOG=$(cat CHANGELOG.txt)
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create new GH Release + Uploading 🌏
uses: softprops/action-gh-release@v2
with:
tag_name: nightly-${{ steps.tagger.outputs.new_tag }}
name: "Nightly Build ${{ steps.tagger.outputs.new_tag }}"
body: |
Automated nightly build generated on ${{ steps.tagger.outputs.formatted_date }}
${{ steps.changelog.outputs.content }}
files: ${{ env.SIGNED_APK }}
prerelease: false
update:
needs: build
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
ref: nightly
fetch-depth: 0
- name: Get Build Number 📆
run: |
VERSION_NUMBER="${{ needs.build.outputs.new_tag }}"
COUNTER_LINKS=""
for (( i=0; i<${#VERSION_NUMBER}; i++ )); do
DIGIT="${VERSION_NUMBER:$i:1}"
COUNTER_LINKS+="[![Download](https://rule34.xxx/counter/$DIGIT.gif)](https://github.com/KotatsuApp/kotatsu-nightly/releases/latest) "
done
sed -i "/### \[Latest Build Number of Kotatsu Nightly\]/,/^$/c\### [Latest Build Number of Kotatsu Nightly](https://github.com/KotatsuApp/kotatsu-nightly/releases/latest)\n${COUNTER_LINKS}\n" README.md
- name: Update Docs + Commit 🌏
run: |
git config --local user.email "[email protected]"
git config --local user.name "Koitharu"
if [[ -n $(git status -s) ]]; then
git add README.md
git commit -m "Bump build number to ${{ needs.build.outputs.new_tag }}"
git push origin nightly
else
echo "No changes to push!"
fi