Skip to content

Commit cddf088

Browse files
committed
feat: attempt gh building
1 parent efb6215 commit cddf088

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

.github/workflows/build.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: nightly
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
env:
12+
NAME: Spotify Extension
13+
TAG: sp
14+
steps:
15+
- name: Checkout repo
16+
uses: actions/checkout@v4
17+
18+
- name: Setup JDK 17
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: 'zulu'
22+
java-version: 17
23+
cache: 'gradle'
24+
25+
- name: Cook Env
26+
run: |
27+
echo -e "## ${{ env.NAME }}\n${{ github.event.head_commit.message }}" > commit.txt
28+
version=$( echo ${{ github.event.head_commit.id }} | cut -c1-7 )
29+
echo "VERSION=v$version" >> $GITHUB_ENV
30+
echo "APP_PATH=app/build/${{ env.TAG }}-$version.eapk" >> $GITHUB_ENV
31+
echo "${{ secrets.KEYSTORE_B64 }}" | base64 -d > $GITHUB_WORKSPACE/signing-key.jks
32+
chmod +x ./gradlew
33+
34+
- name: Build with Gradle
35+
run: |
36+
./gradlew assembleDebug \
37+
-Pandroid.injected.signing.store.file=$GITHUB_WORKSPACE/signing-key.jks \
38+
-Pandroid.injected.signing.store.password=${{ secrets.PASSWORD_STORE }} \
39+
-Pandroid.injected.signing.key.alias=key0 \
40+
-Pandroid.injected.signing.key.password=${{ secrets.PASSWORD_KEY }}
41+
42+
cp app/build/outputs/apk/debug/app-debug.apk ${{ env.APP_PATH }}
43+
44+
- name: Upload APK
45+
uses: actions/upload-artifact@v4
46+
with:
47+
path: ${{ env.APP_PATH }}
48+
49+
- name: Create Release
50+
uses: softprops/action-gh-release@v2
51+
with:
52+
make_latest: true
53+
tag_name: ${{ env.VERSION }}
54+
body_path: commit.txt
55+
name: ${{ env.VERSION }}
56+
files: ${{ env.APP_PATH }}
57+
58+
- name: Delete Old Releases
59+
uses: sgpublic/delete-release-action@master
60+
with:
61+
release-drop: true
62+
release-keep-count: 3
63+
release-drop-tag: true
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
67+
- name: Upload APK to Discord
68+
shell: bash
69+
env:
70+
WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
71+
run: |
72+
commit=$(jq -Rsa . <<< "${{ github.event.head_commit.message }}" | tail -c +2 | head -c -2)
73+
message=$(echo "@everyone **${{ env.VERSION }}**\n$commit")
74+
curl -F "payload_json={\"content\":\"${message}\"}" \
75+
-F "file=@${{ env.APP_PATH }}" \
76+
${{ env.WEBHOOK }}

0 commit comments

Comments
 (0)