Skip to content

Commit

Permalink
Fix Publish Release (#1296)
Browse files Browse the repository at this point in the history
* Restore browser API key

* Adjust gradle task parameters

* Use op secrets step identifier

* Fix op cli configuration for deploy

* Decode play store key

* Correct source directories

* Set version code from github build

* Checkout source code

* Change evaluation function

* Once more with feeling

* Use bash expression evaluation

* Install Ruby

* Include missing comma

* Remove gradle task from fastlane build

---------

Co-authored-by: Ashley Davies <[email protected]>
  • Loading branch information
ashdavies and ashdavies authored Nov 3, 2024
1 parent 5ff77d6 commit 627518e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
with:
service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}

- uses: 1password/load-secrets-action@v2
- id: op-secrets
uses: 1password/load-secrets-action@v2
with:
export-env: false
env:
Expand All @@ -51,7 +52,6 @@ jobs:
GOOGLE_SERVICES: ${{ steps.op-secrets.outputs.GOOGLE_SERVICES }}
KEYSTORE_BASE64: ${{ steps.op-secrets.outputs.KEYSTORE_BASE64 }}
run: |
echo $GOOGLE_SERVICES | base64 --decode > app-launcher/android/google-services.json
echo $GOOGLE_SERVICES | base64 --decode > conferences-app/google-services.json
echo $KEYSTORE_BASE64 | base64 --decode > keystore.jks
Expand All @@ -61,19 +61,23 @@ jobs:
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_ID }}
setup_gcloud: false

- id: version-code
run: echo "VERSION_CODE=$(( (GITHUB_RUN_NUMBER * 2) + 1000 ))" >> $GITHUB_OUTPUT

- env:
ANDROID_API_KEY: ${{ secrets.ANDROID_API_KEY }}
BROWSER_API_KEY: ${{ secrets.BROWSER_API_KEY }}
KEY_STORE_FILE: keystore.jks
KEY_STORE_PASSWORD: ${{ steps.op-secrets.outputs.KEYSTORE_PASSWORD }}
RELEASE_KEY_ALIAS: ${{ steps.op-secrets.outputs.KEY_ALIAS }}
RELEASE_KEY_PASSWORD: ${{ steps.op-secrets.outputs.KEY_PASSWORD }}
SERVER_CLIENT_ID: ${{ secrets.SERVER_CLIENT_ID }}
VERSION_CODE: ${{ steps.version-code.outputs.VERSION_CODE }}
run: |
./gradlew -Pandroidx.baselineprofile.skipgeneration=true --console=plain \
./gradlew \
:conferences-app:assemble \
:conferences-app:bundle \
-x assembleNonMinifiedRelease \
-x bundleNonMinifiedRelease
--console=plain
- uses: actions/upload-artifact@v4
with:
Expand All @@ -86,20 +90,31 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v4
with:
name: android-build-outputs
path: conferences-app/build/outputs

- uses: 1password/load-secrets-action@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- uses: 1password/load-secrets-action/configure@v2
with:
service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}

- id: op-secrets
uses: 1password/load-secrets-action@v2
with:
export-env: false
env:
PLAY_STORE_KEY: op//development/service account key
PLAY_STORE_KEY: op://development/service account key/base64

- env:
PLAY_STORE_KEY: ${{ steps.op-secrets.outputs.PLAY_STORE_KEY }}
run: |
echo $PLAY_STORE_KEY > conferences-app/androidMain/play-store-key.json
echo $PLAY_STORE_KEY | base64 --decode > conferences-app/src/androidMain/play-store-key.json
- run: bundle exec fastlane android publish_to_play_store
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.4
7 changes: 5 additions & 2 deletions conferences-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ android {
}

defaultConfig {
versionName = "1.0"
versionCode = 1
val versionCode by stringPropertyOrNull {
versionCode = it?.toInt() ?: 1
}

versionName = "1.0.0"
}

dependencies {
Expand Down
10 changes: 2 additions & 8 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
default_platform(:android)

platform :android do
lane :publish_to_crashlytics do
gradle(task: "clean assembleRelease")
crashlytics
end

lane :publish_to_play_store do
gradle(task: "clean assembleRelease")
upload_to_play_store(
package_name: "io.ashdavies.playground",
track: "alpha",
json_key: "conferences-app/src/androidMain/play-store-key.json"
aab: "conferences-app/build/outputs/bundle/release/app-standard-release.aab",
json_key: "conferences-app/src/androidMain/play-store-key.json",
aab: "conferences-app/build/outputs/bundle/release/conferences-app-release.aab",
mapping: "conferences-app/build/outputs/mapping/release/mapping.txt",
)
end
Expand Down

0 comments on commit 627518e

Please sign in to comment.