-
-
Notifications
You must be signed in to change notification settings - Fork 4
88 lines (72 loc) · 2.55 KB
/
gradleCI.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
name: 🔨 Gradle Build CI
on:
push:
paths-ignore:
- 'docs/**'
- 'fastlane/**'
- '*.md'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
attestations: write
contents: write
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@v4
- name: ♨️ JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
check-latest: true
- name: ❎ Add exec permission
run: chmod +x gradlew
- name: 🕵️ Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4
- name: 🔐 Decrypt keystore
run: |
echo "${{secrets.KEYSTORE}}" > github_release.jks.asc
gpg -d --passphrase "${{secrets.KEYSTORE_FILE_PASSWORD}}" --batch --output github_release.jks github_release.jks.asc
- name: 🎁 Build
run: |
./gradlew build
- name: 🎁 Build release
run: |
./gradlew assembleRelease \
--project-prop keystore=../github_release.jks \
--project-prop keystorepassword=${{secrets.KEYSTORE_PASSWORD}} \
--project-prop keystorealias=${{secrets.KEYSTORE_KEY_ALIAS}} \
--project-prop keystorekeypassword=${{secrets.KEYSTORE_KEY_PASSWORD}}
- name: 💬 Upload Lint report
if: always()
uses: actions/upload-artifact@v4
with:
name: lint-results.html
path: app/build/reports/lint-results*.html
- name: 🏷️ Extract versionCode
if: ${{ github.ref_type == 'tag' }}
id: version
run: |
versionCode=$(grep -Po "versionCode\s*=\s*\K[0-9]+" app/build.gradle.kts)
echo "versionCode: $versionCode"
echo "versionCode=$versionCode" >> $GITHUB_OUTPUT
- name: 🔖 Rename apk file
if: ${{ github.ref_type == 'tag' }}
env:
VERSION: ${{ github.ref_name }}
run: |
mv app/build/outputs/apk/release/app-release.apk wallpaperexport_gh_${{ steps.version.outputs.versionCode }}.apk
- name: 📜 Attest
if: ${{ github.ref_type == 'tag' }}
uses: actions/attest-build-provenance@v1
with:
subject-path: 'wallpaperexport_gh_${{ steps.version.outputs.versionCode }}.apk'
- name: 🎉 Publish Github release
if: ${{ github.ref_type == 'tag' }}
uses: softprops/action-gh-release@v2
with:
files: wallpaperexport_gh_${{ steps.version.outputs.versionCode }}.apk
body_path: fastlane/metadata/android/en-US/changelogs/${{ steps.version.outputs.versionCode }}.txt