-
-
Notifications
You must be signed in to change notification settings - Fork 7
100 lines (87 loc) · 2.88 KB
/
android-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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# https://dev.to/khromov/build-your-capacitor-android-app-bundle-using-github-actions-24do
name: Build Android app
on:
push:
branches:
- master
jobs:
build:
name: Build and release APK
runs-on: ubuntu-latest
environment: Production
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v1
with:
distribution: 'zulu'
java-version: '11'
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 19.x
- name: Install app dependencies
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
run: npm install
- name: Build app
run: npm run build-mobile-app
- name: Build app assets
uses: mujo-code/[email protected]
env:
CI: "true"
with:
args: npm run build-app-assets
- name: Capacitor sync
run: npx cap sync
- name: Build APK
run: |
cd android && ./gradlew app:tasks --all && ./gradlew assembleRelease
- name: Extract Android signing key from env
run: |
echo "${{ secrets.RELEASE_KEYSTORE }}" > android/release.jks.base64
base64 -d android/release.jks.base64 > android/release.decrypted.jks
- name: Sign build
uses: r0adkll/sign-android-release@v1
id: sign_apk
with:
releaseDirectory: android/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.RELEASE_KEYSTORE }}
alias: release
keyStorePassword: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
env:
# override default build-tools version (29.0.3) -- optional
BUILD_TOOLS_VERSION: "30.0.2"
- name: Copy and rename signed build
run: |
cp ${{steps.sign_apk.outputs.signedReleaseFile}} android/app/build/outputs/apk/release/app-release.apk
- name: Upload release APK
uses: actions/upload-artifact@v2
with:
name: app-release
path: android/app/build/outputs/apk/release/app-release.apk
pre-release:
name: Create Github Release
needs: [build]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Fetch app-release-signed.apk
uses: actions/download-artifact@v1
with:
name: app-release
path: ./app-release
- name: Generate file checksums
run: sha256sum ./app-release/app-release.apk > checksums.txt
- uses: "marvinpinto/action-automatic-releases@latest"
name: Create Release and Upload Assets
id: create_release
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Latest Android Build"
files: |
app-release/app-release.apk
checksums.txt