This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
fix ndk issue #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# name of the workflow | ||
name: Android CI Tag Deployment - Pre | ||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*-**' | ||
jobs: | ||
build: | ||
name: Build Signed APK | ||
runs-on: ubuntu-latest | ||
env: | ||
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | ||
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | ||
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | ||
KEY_STORE_FILE: 'android_keystore.jks' | ||
KEY_STORE_LOCATION: ${{ github.workspace }}/app/keystore/ | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
cache: gradle | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
# Native build dependencies | ||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
- name: Add rust stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Add all targets | ||
run: | | ||
rustup target add \ | ||
aarch64-linux-android \ | ||
armv7-linux-androideabi \ | ||
x86_64-linux-android \ | ||
i686-linux-android | ||
- name: Setup Android SDK | ||
uses: android-actions/setup-android@v3 | ||
- name: Add cargo-ndk | ||
run: | | ||
cargo install cargo-ndk | ||
with: | ||
ndk-version: r23c | ||
# Here we need to decode keystore.jks from base64 string and place it | ||
# in the folder specified in the release signing configuration | ||
- name: Decode Keystore | ||
id: decode_keystore | ||
uses: timheuer/[email protected] | ||
with: | ||
fileName: ${{ env.KEY_STORE_FILE }} | ||
fileDir: ${{ env.KEY_STORE_LOCATION }} | ||
encodedString: ${{ secrets.KEYSTORE }} | ||
# create keystore path for gradle to read | ||
- name: Create keystore path env var | ||
run: | | ||
store_path=${{ env.KEY_STORE_LOCATION }}${{ env.KEY_STORE_FILE }} | ||
echo "KEY_STORE_PATH=$store_path" >> $GITHUB_ENV | ||
- name: Create service_account.json | ||
id: createServiceAccount | ||
run: echo '${{ secrets.SERVICE_ACCOUNT_JSON }}' > service_account.json | ||
# Build and sign APK ("-x test" argument is used to skip tests) | ||
- name: Build Release APK | ||
run: ./gradlew :app:assembleRelease -x test | ||
# get release apk path | ||
# can be fdroid or general, general for now | ||
- name: Get apk path | ||
id: apk-path | ||
run: echo "path=$(find . -regex '^.*/build/outputs/apk/general/release/.*\.apk$' -type f | head -1)" >> $GITHUB_OUTPUT | ||
- name: Get version code | ||
run: | | ||
version_code=$(grep "VERSION_CODE" buildSrc/src/main/kotlin/Constants.kt | awk '{print $5}' | tr -d '\n') | ||
echo "VERSION_CODE=$version_code" >> $GITHUB_ENV | ||
# Save the APK after the Build job is complete to publish it as a Github release in the next job | ||
- name: Upload APK | ||
uses: actions/[email protected] | ||
with: | ||
name: nymvpn | ||
path: ${{ steps.apk-path.outputs.path }} | ||
- name: Download APK from build | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: nymvpn | ||
- name: Create Release with Fastlane changelog notes | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
body_path: ${{ github.workspace }}/fastlane/metadata/android/en-US/changelogs/${{ env.VERSION_CODE }}.txt | ||
tag_name: ${{ github.ref_name }} | ||
name: Release ${{ github.ref_name }} | ||
draft: false | ||
prerelease: true | ||
files: ${{ github.workspace }}/${{ steps.apk-path.outputs.path }} | ||
- name: Deploy with fastlane | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.2' # Not needed with a .ruby-version file | ||
bundler-cache: true | ||
# deploy to google internal track | ||
- name: Distribute app to Beta track 🚀 | ||
run: (cd ${{ github.workspace }} && bundle install && bundle exec fastlane internal) | ||