-
Notifications
You must be signed in to change notification settings - Fork 4
119 lines (103 loc) · 4.59 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Android CI
on:
push:
branches: [ "main" ]
paths:
- android/**
pull_request:
branches: [ "main" ]
paths:
- android/**
release:
types: ["published"]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: source submodules
run: git submodule update --init
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: rust deps
run: cargo install [email protected] --locked
- name: rust targets
run: rustup target add aarch64-linux-android armv7-linux-androideabi
- name: rust cache
uses: actions/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
rust/target/
# An explicit key for restoring and saving the cache
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# Run the post step to save the cache even if another step before fail
save-always: true
- name: gradle cargoNDK plugin needs this file for some reason
run: touch android/local.properties
- name: Grant execute permission for gradlew
working-directory: android/
run: chmod +x gradlew
- name: Build with Gradle
if: ${{ !(github.event_name == 'release') }}
working-directory: android/
run: ./gradlew build
- name: Decode and write Keystore
if: ${{ (github.event_name == 'release') }}
env:
SIGNING_STORE_BASE64: ${{ secrets.SIGNING_STORE_BASE64 }}
run: |
KEYSTORE_DIR="/keystore/"
mkdir -p "${KEYSTORE_DIR}"
echo ${SIGNING_STORE_BASE64} | base64 -d > "${KEYSTORE_DIR}"/keystore.jks
- name: Change gradle signing config to github release
if: ${{ (github.event_name == 'release') }}
run: |
sed -i 's/signingConfigs.getByName("debug")/signingConfigs.getByName("github")/g' android/app/build.gradle.kts
- name: Build with Gradle for release
if: ${{ (github.event_name == 'release') }}
working-directory: android/
run: ./gradlew build assembleSource-originalRelease
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
- uses: Shopify/[email protected]
if: ${{ (github.event_name == 'release') }}
with:
name: sharepaste.oo-source-original-arm64-v8a-release.apk
path: android/app/build/outputs/apk/source-original/release/sharepaste.oo-source-original-arm64-v8a-release.apk
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Shopify/[email protected]
if: ${{ (github.event_name == 'release') }}
with:
name: sharepaste.oo-source-original-armeabi-v7a-release.apk
path: android/app/build/outputs/apk/source-original/release/sharepaste.oo-source-original-armeabi-v7a-release.apk
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Shopify/[email protected]
if: ${{ (github.event_name == 'release') }}
with:
name: sharepaste.oo-source-original-universal-release.apk
path: android/app/build/outputs/apk/source-original/release/sharepaste.oo-source-original-universal-release.apk
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Build Artifacts (Apks)
if: ${{ !(github.event_name == 'release') }}
uses: actions/[email protected]
with:
# Artifact name
name: BuiltApks-${{ github.sha }}
# A file, directory or wildcard pattern that describes what to upload
path: android/app/build/outputs/apk/**/release/
# The level of compression for Zlib to be applied to the artifact archive. The value can range from 0 to 9: - 0: No compression - 1: Best speed - 6: Default compression (same as GNU Gzip) - 9: Best compression Higher levels will result in better compression, but will take longer to complete. For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads.
compression-level: 9
# If true, an artifact with a matching name will be deleted before a new one is uploaded. If false, the action will fail if an artifact for the given name already exists. Does not fail if the artifact does not exist.
#overwrite: # optional, default is false