-
Notifications
You must be signed in to change notification settings - Fork 62
178 lines (150 loc) · 5.35 KB
/
build.yml
File metadata and controls
178 lines (150 loc) · 5.35 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: APK Build
on:
push:
tags:
- 'v*'
workflow_dispatch:
env:
OPENSSL_VERSION: "3.0.15"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.SUBMODULE_TOKEN }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'jetbrains'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install Android NDK
run: |
sdkmanager --install "ndk;29.0.14206865"
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/29.0.14206865" >> $GITHUB_ENV
- name: Cache Rust/Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo
~/.rustup
app/src/main/rust/slipstream-rust/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android
- name: Install cargo-ndk
run: cargo install cargo-ndk --locked
- name: Cache OpenSSL
id: cache-openssl
uses: actions/cache@v4
with:
path: ~/android-openssl
key: openssl-android-${{ env.OPENSSL_VERSION }}
- name: Build OpenSSL for Android
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: |
chmod +x app/scripts/build-openssl-android.sh
OUTPUT_DIR=$HOME/android-openssl/android-ssl \
OPENSSL_VERSION=${{ env.OPENSSL_VERSION }} \
./app/scripts/build-openssl-android.sh
- name: Verify OpenSSL installation
run: |
for abi in arm64-v8a armeabi-v7a x86_64; do
for lib in libssl.a libcrypto.a; do
test -f ~/android-openssl/android-ssl/$abi/lib/$lib || { echo "Missing $abi/lib/$lib"; exit 1; }
done
done
echo "OpenSSL verification passed"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: gomobile-build/go.mod
cache-dependency-path: gomobile-build/go.sum
- name: Install gomobile
run: go install golang.org/x/mobile/cmd/gomobile@latest && gomobile init
- name: Build Go mobile libraries
working-directory: gomobile-build
run: make build
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Decode Keystore
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
run: |
if [ -n "$KEYSTORE_BASE64" ]; then
echo "$KEYSTORE_BASE64" | base64 -d > slipnet-release.keystore
echo "KEYSTORE_DECODED=true" >> $GITHUB_ENV
fi
- name: Create keystore.properties
if: env.KEYSTORE_DECODED == 'true'
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
cat > keystore.properties <<EOF
storeFile=../slipnet-release.keystore
storePassword=$KEYSTORE_PASSWORD
keyAlias=$KEY_ALIAS
keyPassword=$KEY_PASSWORD
EOF
# Strip leading whitespace from heredoc indentation
sed -i 's/^[[:space:]]*//' keystore.properties
- name: Set up local.properties
env:
CONFIG_ENCRYPTION_KEY: ${{ secrets.CONFIG_ENCRYPTION_KEY }}
run: |
echo "sdk.dir=$ANDROID_HOME" > local.properties
echo "CONFIG_ENCRYPTION_KEY=$CONFIG_ENCRYPTION_KEY" >> local.properties
- name: Build Full Release APK
run: ./gradlew assembleFullRelease --no-daemon
- name: Build Lite Release APK
run: ./gradlew assembleLiteRelease --no-daemon
- name: Collect release APKs
run: |
mkdir -p release-apks
cp app/build/outputs/apk/full/release/SlipNet-*-full-*.apk release-apks/ 2>/dev/null || true
cp app/build/outputs/apk/lite/release/SlipNet-*-lite-*.apk release-apks/ 2>/dev/null || true
- name: Upload Release APKs
uses: actions/upload-artifact@v4
with:
name: app-release
path: release-apks/*.apk
retention-days: 5
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download Release APK
uses: actions/download-artifact@v4
with:
name: app-release
path: ./artifacts
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/*.apk
generate_release_notes: true
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') || contains(github.ref, 'rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}