-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (97 loc) · 3.71 KB
/
Copy pathrelease-apk.yml
File metadata and controls
116 lines (97 loc) · 3.71 KB
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
name: Build & Publish APK
# Restricted to version tags. Signing + upload secrets live in the protected
# "release" GitHub Environment, whose deployment policy only allows v* tags —
# so a push to a branch can never access the signing key or upload token.
on:
push:
tags: ['v*']
permissions:
contents: write # create GitHub Releases and upload assets
packages: write # publish ghcr container images
jobs:
build:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Android SDK
uses: android-actions/setup-android@v3
- name: Set up Go (for gomobile / wglib.aar)
uses: actions/setup-go@v5
with:
go-version-file: wgmodule/go.mod
cache-dependency-path: wgmodule/go.sum
- name: Install Android NDK r25c
run: sdkmanager "ndk;25.2.9519653"
- name: Build wglib.aar
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
ANDROID_NDK_HOME="$ANDROID_HOME/ndk/25.2.9519653" gomobile init
mkdir -p android/app/libs
cd wgmodule
ANDROID_NDK_HOME="$ANDROID_HOME/ndk/25.2.9519653" \
gomobile bind -target android -androidapi 26 \
-o ../android/app/libs/wglib.aar .
- name: Decode signing keystore
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/release.keystore
- name: Determine version
id: ver
run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
- name: Build release APK
working-directory: android
env:
KEYSTORE_FILE: release.keystore
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: ./gradlew assembleRelease --no-daemon
- name: Stage named APK
run: cp android/app/build/outputs/apk/release/app-release.apk "ipv6diag-${{ steps.ver.outputs.version }}.apk"
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
files: ipv6diag-${{ steps.ver.outputs.version }}.apk
generate_release_notes: true
- name: Upload APK to portal
continue-on-error: true
run: |
curl -fsSL --retry 3 -X POST \
-H "Authorization: Bearer ${{ secrets.APK_UPLOAD_TOKEN }}" \
-H "X-App-Version: ${{ steps.ver.outputs.version }}" \
-H "Content-Type: application/vnd.android.package-archive" \
--data-binary @android/app/build/outputs/apk/release/app-release.apk \
https://ipv6-diag.r.selvakn.in/upload-apk
publish-container:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract container metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/androidipv6diag-server
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Build and push server container
uses: docker/build-push-action@v6
with:
context: ./server
file: ./server/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}