Skip to content

Commit f2bd0af

Browse files
committed
use release key for android app
1 parent a664c76 commit f2bd0af

File tree

3 files changed

+37
-20
lines changed

3 files changed

+37
-20
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
platform: windows
2424
- os: macos-13
2525
platform: macos
26-
26+
2727
steps:
2828
- name: Checkout code
2929
uses: actions/checkout@v4
@@ -65,14 +65,14 @@ jobs:
6565

6666
- name: Install cargo-packager
6767
run: cargo install cargo-packager --locked
68-
68+
6969
- name: Package (Linux)
7070
if: matrix.platform == 'linux'
7171
working-directory: ./RustApp
7272
run: |
7373
cargo build --release --target x86_64-unknown-linux-gnu
7474
cargo packager -r -f appimage --target x86_64-unknown-linux-gnu
75-
75+
7676
- name: Package (Windows)
7777
if: matrix.platform == 'windows'
7878
working-directory: ./RustApp
@@ -90,7 +90,7 @@ jobs:
9090
cargo packager -r -f dmg --target x86_64-apple-darwin
9191
cargo build --release --target aarch64-apple-darwin
9292
cargo packager -r -f dmg --target aarch64-apple-darwin
93-
93+
9494
# For Linux
9595
- name: Upload Linux binary
9696
if: matrix.platform == 'linux'
@@ -99,7 +99,7 @@ jobs:
9999
name: androidmic-linux
100100
path: ./RustApp/target/x86_64-unknown-linux-gnu/release/*.AppImage
101101
if-no-files-found: warn
102-
102+
103103
# For Windows
104104
- name: Upload Windows built files
105105
if: matrix.platform == 'windows'
@@ -110,7 +110,7 @@ jobs:
110110
./RustApp/target/x86_64-pc-windows-msvc/release/*setup.exe
111111
./RustApp/target/i686-pc-windows-msvc/release/*setup.exe
112112
if-no-files-found: warn
113-
113+
114114
# For macOS
115115
- name: Upload macOS built files
116116
if: matrix.platform == 'macos'
@@ -125,11 +125,11 @@ jobs:
125125
build-android:
126126
name: Build Android App
127127
runs-on: ubuntu-latest
128-
128+
129129
steps:
130130
- name: Checkout code
131131
uses: actions/checkout@v4
132-
132+
133133
- name: Set up JDK 21
134134
uses: actions/setup-java@v4
135135
with:
@@ -138,13 +138,20 @@ jobs:
138138
cache: gradle
139139

140140
- name: Build Release APK
141+
env:
142+
KEY_BASE64: ${{ secrets.KEY_BASE64 }}
143+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
144+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
145+
STORE_PASSWORD: ${{ secrets.KEY_PASSWORD }}
141146
working-directory: ./Android
142-
run: ./gradlew assembleRelease
143-
147+
run: |
148+
echo $KEY_BASE64 | base64 --decode > app/key.jks
149+
./gradlew assembleRelease
150+
144151
- name: List APK files
145152
working-directory: ./Android
146153
run: find app/build/outputs -name "*.apk"
147-
154+
148155
- name: Upload Android APK
149156
uses: actions/upload-artifact@v4
150157
with:
@@ -156,17 +163,17 @@ jobs:
156163
name: Create GitHub Release
157164
needs: [build-app, build-android]
158165
runs-on: ubuntu-latest
159-
166+
160167
steps:
161168
- name: Checkout code
162169
uses: actions/checkout@v4
163-
170+
164171
- name: Download all artifacts
165172
uses: actions/download-artifact@v4
166173
with:
167174
merge-multiple: true
168175
path: all-artifacts
169-
176+
170177
- name: Display structure of downloaded files
171178
run: find all-artifacts -type f | sort
172179

@@ -176,7 +183,7 @@ jobs:
176183
VERSION=$(grep '^version' ./RustApp/Cargo.toml | head -n 1 | awk -F '"' '{print $2}')
177184
echo "VERSION=$VERSION" >> $GITHUB_ENV
178185
echo "version=$VERSION" >> $GITHUB_OUTPUT
179-
186+
180187
- name: Create Release
181188
uses: softprops/action-gh-release@v1
182189
with:
@@ -187,13 +194,13 @@ jobs:
187194
files: all-artifacts/**/*
188195
body: |
189196
## AndroidMic v${{ env.VERSION }}
190-
197+
191198
### What's Changed
192199
<!-- You can add manual notes here, they will be combined with automated notes -->
193200
- Several improvements and bug fixed
194-
201+
195202
### Installation
196203
- For Android: Install the `.apk` file
197204
- For Linux: Download and run the `.AppImage` binary
198205
- For Windows: Download and run the `.exe` installer
199-
- For macOS: Download and run the `.dmg` file
206+
- For macOS: Download and run the `.dmg` file

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
release/*
22
*.zip
33
.vscode
4-
.DS_Store
4+
.DS_Store
5+
.env

Android/app/build.gradle.kts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ android {
2727
}
2828

2929
signingConfigs {
30+
create("release") {
31+
// on powershell
32+
// $env:KEY_ALIAS = "var"
33+
keyAlias = System.getenv("KEY_ALIAS")
34+
keyPassword = System.getenv("KEY_PASSWORD")
35+
storeFile = file("key.jks")
36+
storePassword = System.getenv("STORE_PASSWORD")
37+
}
38+
3039
// need this because debug key is machine dependent
3140
create("nightly") {
3241
keyAlias = "key0"
@@ -43,7 +52,7 @@ android {
4352
getDefaultProguardFile("proguard-android-optimize.txt"),
4453
"proguard-rules.pro"
4554
)
46-
signingConfig = signingConfigs.getByName("debug")
55+
signingConfig = signingConfigs.getByName("release")
4756
}
4857

4958
create("nightly") {

0 commit comments

Comments
 (0)