-
-
Notifications
You must be signed in to change notification settings - Fork 4
79 lines (65 loc) · 2.31 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
name: 🔨 Gradle Build CI
on:
push:
paths-ignore:
- 'docs/**'
- 'fastlane/**'
- '*.md'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- 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/wrapper-validation-action@v3
- name: 🔐 Decrypt keystore
if: ${{ github.ref_type == 'tag' }}
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
if: ${{ github.ref_type != 'tag' }}
run: |
./gradlew build
- name: 🎁 Build release
if: ${{ github.ref_type == 'tag' }}
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+\K[0-9]+" app/build.gradle)
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: 🎉 Publish Github release
if: ${{ github.ref_type == 'tag' }}
uses: softprops/[email protected]
with:
files: wallpaperexport_gh_${{ steps.version.outputs.versionCode }}.apk
body_path: fastlane/metadata/android/en-US/changelogs/${{ steps.version.outputs.versionCode }}.txt