Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
louischan-oursky committed Nov 7, 2023
1 parent 7489190 commit 110746d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
runs-on: macos-12
needs: ["test"]
if: github.ref == 'refs/heads/main'
env:
# The version depends on the Android Gradle Plugin version in /build.gradle.kts
BUILD_TOOLS_VERSION: "33.0.1"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -37,7 +40,7 @@ jobs:
- name: Set versionCode
run: |
VERSION_CODE=$(date +%s)
sed -I "" "s/versionCode 1/versionCode $VERSION_CODE/" ./javasample/build.gradle
sed -I "" "s/versionCode = 1/versionCode = $VERSION_CODE/" ./javasample/build.gradle.kts
- name: Build unsigned APK
run: ./gradlew javasample:assembleRelease
- name: Install keystore
Expand All @@ -48,15 +51,13 @@ jobs:
echo -n "$ANDROID_KEYSTORE_BASE64" | base64 --decode -o $KEYSTORE_PATH
- name: Run zipalign
run: |
BUILD_TOOLS_VERSION=$(sed -n -E 's/.*buildToolsVersion "(.*)"/\1/p' ./javasample/build.gradle)
"$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/zipalign" -c -v 4 ./javasample/build/outputs/apk/release/javasample-release-unsigned.apk
- name: Run apksigner
env:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
BUILD_TOOLS_VERSION=$(sed -n -E 's/.*buildToolsVersion "(.*)"/\1/p' ./javasample/build.gradle)
"$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/apksigner" sign \
--ks $RUNNER_TEMP/keystore.jks \
--ks-key-alias "$ANDROID_KEY_ALIAS" \
Expand Down
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
// Android Gradle Plugin 8.1 always use SDK Build Tools 33.0.1
// https://developer.android.com/build/releases/gradle-plugin#8-1-0
// If you ever update Android Gradle Plugin, please also update
// BUILD_TOOLS_VERSION in ./.github/workflows/ci.yaml
id("com.android.library") version "8.1.2" apply false
id("com.android.application") version "8.1.2" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
Expand Down

0 comments on commit 110746d

Please sign in to comment.