-
Notifications
You must be signed in to change notification settings - Fork 8
102 lines (85 loc) · 3.17 KB
/
android.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Android Build
on:
workflow_run:
workflows: ["Electron Build and Release"]
types:
- completed
jobs:
release:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./capacitor
steps:
- name: Check out Git repository
uses: actions/checkout@v3
with:
fetch-tags: true
- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 9.4.0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '19'
check-latest: true
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install node-pre-gyp
run: pnpm install -g node-pre-gyp
- name: Remove Cached Build
run: rm -rf ./build && mkdir ./build
- name: Build Native + Web
run: pnpm run build:app
- name: Sync
run: pnpm exec cap sync android
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build App
run: cd android && chmod +x ./gradlew && ./gradlew assembleRelease
- name: Stop Gradle daemon
run: cd android && ./gradlew --stop
- 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
- uses: filippoLeporati93/android-release-signer@v1
name: Sign app APK
id: sign_app
with:
releaseDirectory: capacitor/android/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
- uses: jungwinter/split@v2
id: signed_files
with:
msg: ${{ steps.sign_app.outputs.signedReleaseFiles }}
separator: ':'
- name: Upload APK to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git fetch --tags
gh release upload --clobber $(gh release list --limit 1 --json tagName --jq '.[0].tagName') ../${{ steps.signed_files.outputs._0 }}
gh release upload --clobber $(gh release list --limit 1 --json tagName --jq '.[0].tagName') ../${{ steps.signed_files.outputs._1 }}
gh release upload --clobber $(gh release list --limit 1 --json tagName --jq '.[0].tagName') ../${{ steps.signed_files.outputs._2 }}
gh release upload --clobber $(gh release list --limit 1 --json tagName --jq '.[0].tagName') ../${{ steps.signed_files.outputs._3 }}