forked from GustavoASantos/Noti
-
Notifications
You must be signed in to change notification settings - Fork 2
79 lines (72 loc) · 2.73 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
name: APK Builder
on:
push:
branches: [main]
workflow_dispatch:
jobs:
apk:
name: Generate APK
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Keystore
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
echo "storePassword=$KEYSTORE_PASSWORD" >> keystore.properties
echo "keyAlias=$KEY_ALIAS" >> keystore.properties
echo "keyPassword=$KEY_PASSWORD" >> keystore.properties
echo "storeFile=${{ github.workspace }}/key.jks" >> keystore.properties
echo "$KEYSTORE" | base64 --decode > "${{ github.workspace }}/key.jks"
- name: Build Release APK
run: |
./gradlew assembleRelease \
-PKEYSTORE_FILE=${{ github.workspace }}/key.jks \
-PKEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }} \
-PKEY_ALIAS=${{ secrets.KEY_ALIAS }} \
-PKEY_PASSWORD=${{ secrets.KEY_PASSWORD }} --stacktrace
mv ./app/build/outputs/apk/release/app-release.apk "./${{ github.event.repository.name }}.apk"
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: ./${{ github.event.repository.name }}.apk
release:
name: Release APK
runs-on: ubuntu-latest
needs: apk
steps:
- name: Download APK Artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
with:
tag_name: ${{ github.run_number }}
release_name: Release ${{ github.run_number }}
body: "Please check [this](https://github.com/Burhanverse/Noti#how-to-allow-restricted-settings) to Allow Restricted Settings for Noti."
- name: Upload Release APK
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ github.event.repository.name }}.apk
asset_name: ./${{ github.event.repository.name }}.apk
asset_content_type: application/vnd.android.package-archive