-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (109 loc) · 3.9 KB
/
build-android.yaml
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
name: Build APP
on:
push:
tags:
- v*
workflow_dispatch:
jobs:
build:
name: Build APK
runs-on: ubuntu-latest
strategy:
matrix:
task:
- assembleNsfwDisabledNoKeyDozeEnabledBillingDisabled
- assembleNsfwEnabledNoKeyDozeEnabledBillingDisabled
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract directory
id: extract_name
uses: actions/github-script@v7
with:
result-encoding: string
script: |
return '${{ matrix.task }}'.replace('assembleN', 'n');
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Set up API keys
run: |
echo "prod_api_key=0000000000" >> local.properties
echo "dev_api_key=0000000000" >> local.properties
echo "support_email=${{ secrets.SUPPORT_EMAIL }}" >> local.properties
echo "examples_url=${{ secrets.EXAMPLES_URL }}" >> local.properties
echo "weather_api_key=${{ secrets.WEATHER_API_KEY }}" >> local.properties
- name: Setup build tool version variable
shell: bash
run: |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
echo Last build tool version is: $BUILD_TOOL_VERSION
- name: Build with Gradle
run: ./gradlew ${{ matrix.task }}
- name: Sign Android release
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/${{ steps.extract_name.outputs.result }}/release/
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.extract_name.outputs.result }}
path: ${{ steps.sign_app.outputs.signedReleaseFile }}
if-no-files-found: error
retention-days: 1
create_release:
name: Create a release
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push'
permissions:
contents: write
steps:
- name: Extract version name
id: extract_name
uses: actions/github-script@v7
with:
result-encoding: string
script: |
return context.payload.ref.replace(/refs\/tags\/v/, '');
- name: Download SFW
uses: actions/download-artifact@v4
with:
name: nsfwDisabledNoKeyDozeEnabledBillingDisabled
path: sfw
- name: Download NSFW
uses: actions/download-artifact@v4
with:
name: nsfwEnabledNoKeyDozeEnabledBillingDisabled
path: nsfw
- name: Rename files
run: |
mv sfw/*.apk cz.chrastecky.aiwallpaperchanger_${{ steps.extract_name.outputs.result }}_SFW.apk
mv nsfw/*.apk cz.chrastecky.aiwallpaperchanger_${{ steps.extract_name.outputs.result }}_NSFW.apk
- name: Create a release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release ${{ steps.extract_name.outputs.result }}
draft: false
prerelease: false
fail_on_unmatched_files: true
generate_release_notes: true
make_latest: true
files: |
cz.chrastecky.aiwallpaperchanger_${{ steps.extract_name.outputs.result }}_SFW.apk
cz.chrastecky.aiwallpaperchanger_${{ steps.extract_name.outputs.result }}_NSFW.apk