change: build pipeline to fastlane deploy
This commit is contained in:
parent
eb7b39c379
commit
90b006acc5
|
@ -9,8 +9,15 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Signed APK
|
name: Build Signed APK
|
||||||
|
# change to macos because of hilt issues on ubuntu in gradle 8.3
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
KEY_STORE_PATH: ${{ secrets.KEY_STORE_PATH }}
|
||||||
|
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
|
||||||
|
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
|
||||||
|
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
|
@ -29,72 +36,55 @@ jobs:
|
||||||
uses: timheuer/base64-to-file@v1.2
|
uses: timheuer/base64-to-file@v1.2
|
||||||
with:
|
with:
|
||||||
fileName: 'android_keystore.jks'
|
fileName: 'android_keystore.jks'
|
||||||
fileDir: '/home/runner/work/wgtunnel/wgtunnel/app/keystore/'
|
fileDir: ${{ github.workspace }}/app/keystore/
|
||||||
encodedString: ${{ secrets.KEYSTORE }}
|
encodedString: ${{ secrets.KEYSTORE }}
|
||||||
|
|
||||||
|
- 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)
|
# Build and sign APK ("-x test" argument is used to skip tests)
|
||||||
# add fdroid flavor for apk upload
|
# add fdroid flavor for apk upload
|
||||||
- name: Build Fdroid Release APK
|
- name: Build Fdroid Release APK
|
||||||
run: ./gradlew :app:assembleFdroidRelease -x test
|
run: ./gradlew :app:assembleFdroidRelease -x test
|
||||||
env:
|
|
||||||
KEY_STORE_PATH: ${{ secrets.KEY_STORE_PATH }}
|
|
||||||
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
|
|
||||||
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
|
|
||||||
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
|
|
||||||
|
|
||||||
# get fdroid flavor release apk path
|
# get fdroid flavor release apk path
|
||||||
- name: Get apk path
|
- name: Get apk path
|
||||||
id: apk-path
|
id: apk-path
|
||||||
run: echo "path=$(find . -regex '^.*/build/outputs/apk/fdroid/release/.*\.apk$' -type f | head -1)" >> $GITHUB_OUTPUT
|
run: echo "path=$(find . -regex '^.*/build/outputs/apk/fdroid/release/.*\.apk$' -type f | head -1)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# add general flavor for google play
|
|
||||||
- name: Build General Release AAB
|
|
||||||
id: buildRelease
|
|
||||||
run: ./gradlew bundleGeneralRelease
|
|
||||||
env:
|
|
||||||
KEY_STORE_PATH: ${{ secrets.KEY_STORE_PATH }}
|
|
||||||
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
|
|
||||||
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
|
|
||||||
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
|
|
||||||
|
|
||||||
# Save the APK after the Build job is complete to publish it as a Github release in the next job
|
# Save the APK after the Build job is complete to publish it as a Github release in the next job
|
||||||
- name: Upload APK
|
- name: Upload APK
|
||||||
uses: actions/upload-artifact@v3.1.2
|
uses: actions/upload-artifact@v3.1.2
|
||||||
with:
|
with:
|
||||||
name: wgtunnel
|
name: wgtunnel
|
||||||
path: ${{ steps.apk-path.outputs.path }}
|
path: ${{ steps.apk-path.outputs.path }}
|
||||||
|
|
||||||
- name: Create service_account.json
|
|
||||||
id: createServiceAccount
|
|
||||||
run: echo '${{ secrets.SERVICE_ACCOUNT_JSON }}' > service_account.json
|
|
||||||
|
|
||||||
# upload general flavor release aab to beta track
|
|
||||||
- name: Publish to Play Store BETA
|
|
||||||
id: publish
|
|
||||||
uses: r0adkll/upload-google-play@v1.1.2
|
|
||||||
with:
|
|
||||||
serviceAccountJson: service_account.json
|
|
||||||
packageName: com.zaneschepke.wireguardautotunnel
|
|
||||||
releaseFiles: app/build/outputs/bundle/generalRelease/app-general-release.aab
|
|
||||||
track: beta
|
|
||||||
|
|
||||||
release:
|
|
||||||
name: Release APK
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Download APK from build
|
- name: Download APK from build
|
||||||
uses: actions/download-artifact@v1
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: wgtunnel
|
name: wgtunnel
|
||||||
- name: Create Release
|
- name: Create Release with Fastlane changelog notes
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
|
# fix hardcode changelog file name
|
||||||
|
body_path: ${{ github.workspace }}/fastlane/metadata/android/en-US/changelogs/32100.txt
|
||||||
tag_name: ${{ github.ref_name }}
|
tag_name: ${{ github.ref_name }}
|
||||||
name: Release ${{ github.ref_name }}
|
name: Release ${{ github.ref_name }}
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
files: wgtunnel/${{ steps.apk-path.outputs.path }}
|
files: ${{ github.workspace }}/${{ steps.apk-path.outputs.path }}
|
||||||
|
deploy:
|
||||||
|
name: Deploy with fastlane
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: '3.2' # Not needed with a .ruby-version file
|
||||||
|
bundler-cache: true
|
||||||
|
|
||||||
|
- name: Distribute app to Beta track 🚀
|
||||||
|
run: (cd ${{ github.workspace }} && bundle install && bundle exec fastlane beta)
|
||||||
|
|
|
@ -9,15 +9,15 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.zaneschepke.wireguardautotunnel"
|
namespace = Constants.APP_ID
|
||||||
compileSdk = 34
|
compileSdk = Constants.TARGET_SDK
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "com.zaneschepke.wireguardautotunnel"
|
applicationId = Constants.APP_ID
|
||||||
minSdk = 26
|
minSdk = Constants.MIN_SDK
|
||||||
targetSdk = 34
|
targetSdk = Constants.TARGET_SDK
|
||||||
versionCode = 32000
|
versionCode = Constants.VERSION_CODE
|
||||||
versionName = "3.2.1"
|
versionName = Constants.VERSION_NAME
|
||||||
|
|
||||||
ksp {
|
ksp {
|
||||||
arg("room.schemaLocation", "$projectDir/schemas")
|
arg("room.schemaLocation", "$projectDir/schemas")
|
||||||
|
@ -41,16 +41,12 @@ android {
|
||||||
load(file("signing_template.properties").reader())
|
load(file("signing_template.properties").reader())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val storePassVarName = "SIGNING_STORE_PASSWORD"
|
|
||||||
val keyAliasVarName = "SIGNING_KEY_ALIAS"
|
|
||||||
val keyPassVarName = "SIGNING_KEY_PASSWORD"
|
|
||||||
val keyStorePathVarName = "KEY_STORE_PATH"
|
|
||||||
|
|
||||||
//try to get secrets from env first for pipeline build, then properties file for local build
|
//try to get secrets from env first for pipeline build, then properties file for local build
|
||||||
storeFile = file(System.getenv().getOrDefault(keyStorePathVarName, properties.getProperty(keyStorePathVarName)))
|
storeFile = file(System.getenv().getOrDefault(Constants.KEY_STORE_PATH_VAR, properties.getProperty(Constants.KEY_STORE_PATH_VAR)))
|
||||||
storePassword = System.getenv().getOrDefault(storePassVarName, properties.getProperty(storePassVarName))
|
storePassword = System.getenv().getOrDefault(Constants.STORE_PASS_VAR, properties.getProperty(Constants.STORE_PASS_VAR))
|
||||||
keyAlias = System.getenv().getOrDefault(keyAliasVarName, properties.getProperty(keyAliasVarName))
|
keyAlias = System.getenv().getOrDefault(Constants.KEY_ALIAS_VAR, properties.getProperty(Constants.KEY_ALIAS_VAR))
|
||||||
keyPassword = System.getenv().getOrDefault(keyPassVarName, properties.getProperty(keyPassVarName))
|
keyPassword = System.getenv().getOrDefault(Constants.KEY_PASS_VAR, properties.getProperty(Constants.KEY_PASS_VAR))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,6 +115,14 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register("printVersionCode") {
|
||||||
|
doLast {
|
||||||
|
//print version code for CI
|
||||||
|
println(Constants.VERSION_CODE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
val generalImplementation by configurations
|
val generalImplementation by configurations
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(libs.androidx.core.ktx)
|
implementation(libs.androidx.core.ktx)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
SIGNING_STORE_PASSWORD=
|
SIGNING_STORE_PASSWORD=
|
||||||
SIGNING_KEY_ALIAS=
|
SIGNING_KEY_ALIAS=
|
||||||
SIGNING_KEY_PASSWORD=
|
SIGNING_KEY_PASSWORD=
|
||||||
KEY_STORE_PATH=
|
KEY_STORE_PATH=/
|
|
@ -7,8 +7,6 @@ buildscript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application) apply false
|
alias(libs.plugins.android.application) apply false
|
||||||
alias(libs.plugins.kotlin.android) apply false
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
object Constants {
|
||||||
|
const val VERSION_NAME = "3.2.1"
|
||||||
|
const val VERSION_CODE = 32100
|
||||||
|
const val TARGET_SDK = 34
|
||||||
|
const val MIN_SDK = 26
|
||||||
|
const val APP_ID = "com.zaneschepke.wireguardautotunnel"
|
||||||
|
|
||||||
|
const val STORE_PASS_VAR = "SIGNING_STORE_PASSWORD"
|
||||||
|
const val KEY_ALIAS_VAR = "SIGNING_KEY_ALIAS"
|
||||||
|
const val KEY_PASS_VAR = "SIGNING_KEY_PASSWORD"
|
||||||
|
const val KEY_STORE_PATH_VAR = "KEY_STORE_PATH"
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
json_key_file "service_account.json"
|
||||||
|
package_name "com.zaneschepke.wireguardautotunnel"
|
|
@ -0,0 +1,17 @@
|
||||||
|
default_platform(:android)
|
||||||
|
|
||||||
|
platform :android do
|
||||||
|
|
||||||
|
desc "Deploy a beta version to the Google Play"
|
||||||
|
lane :beta do
|
||||||
|
gradle(task: "clean bundleGeneralRelease")
|
||||||
|
upload_to_play_store(track: 'beta')
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Deploy a new version to the Google Play"
|
||||||
|
lane :production do
|
||||||
|
gradle(task: "clean bundleGeneralRelease")
|
||||||
|
upload_to_play_store
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
Enhancements:
|
||||||
|
- Fix < Android 9 permission bug
|
||||||
|
- Other optimizations
|
|
@ -21,7 +21,7 @@ navigationCompose = "2.7.5"
|
||||||
roomVersion = "2.6.0"
|
roomVersion = "2.6.0"
|
||||||
timber = "5.0.1"
|
timber = "5.0.1"
|
||||||
tunnel = "1.0.20230706"
|
tunnel = "1.0.20230706"
|
||||||
androidGradlePlugin = "8.3.0-alpha06"
|
androidGradlePlugin = "8.2.0-rc03"
|
||||||
kotlin="1.9.10"
|
kotlin="1.9.10"
|
||||||
ksp="1.9.10-1.0.13"
|
ksp="1.9.10-1.0.13"
|
||||||
composeBom="2023.10.01"
|
composeBom="2023.10.01"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#Wed Oct 11 22:39:21 EDT 2023
|
#Wed Oct 11 22:39:21 EDT 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
Loading…
Reference in New Issue