-
Notifications
You must be signed in to change notification settings - Fork 18
90 lines (77 loc) · 2.45 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
name: Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
release:
types: [published]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
- name: Check out Yggdrasil
uses: actions/checkout@v3
with:
repository: yggdrasil-network/yggdrasil-go
path: yggdrasil-go
ref: develop
fetch-depth: 0
- name: Setup Go environment
uses: actions/[email protected]
- name: Install gomobile
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
~/go/bin/gomobile init
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Install NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r21e
add-to-path: false
- name: Build Yggdrasil
run: |
mkdir app/libs
cd yggdrasil-go
PATH=$PATH:~/go/bin/ ./contrib/mobile/build -a
cp {yggdrasil.aar,yggdrasil-sources.jar} ../app/libs
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Gradle build
if: github.event_name != 'release' && github.ref_name != 'main'
run: |
chmod +x gradlew
./gradlew buildRelease
- name: Gradle signed build
if: github.event_name == 'release' || github.ref_name == 'main'
run: |
echo "${{ secrets.RELEASE_KEYSTORE }}" > app/gha.keystore.asc
gpg -d --passphrase "${{ secrets.RELEASE_KEYSTORE_PASSWORD }}" --batch app/gha.keystore.asc > app/gha.jks
chmod +x gradlew
./gradlew assembleYggdrasil
- name: Upload build artifact
if: github.event_name == 'release' || github.ref_name == 'main'
uses: actions/upload-artifact@v3
with:
name: yggdrasil-android
path: app/build/outputs/apk/yggdrasil/app-yggdrasil.apk
- name: Upload release artifact
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: app/build/outputs/apk/yggdrasil/app-yggdrasil.apk
asset_name: yggdrasil-android.apk
asset_content_type: application/vnd.android.package-archive