From f128556a49eac4fd6f69e2207a4069ebd5f2ce0d Mon Sep 17 00:00:00 2001 From: Grishka Date: Fri, 1 Mar 2024 09:38:31 +0300 Subject: [PATCH] Add github action --- .github/workflows/build_and_deploy.yml | 56 +++++++++++++++++++ fastlane/Fastfile | 6 -- .../metadata/android/en-US/changelogs/86.txt | 3 + mastodon/ci_signing.gradle | 20 +++++++ 4 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build_and_deploy.yml create mode 100644 fastlane/metadata/android/en-US/changelogs/86.txt create mode 100644 mastodon/ci_signing.gradle diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml new file mode 100644 index 00000000..1697342e --- /dev/null +++ b/.github/workflows/build_and_deploy.yml @@ -0,0 +1,56 @@ +name: Build and deploy + +on: + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 21 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.2 + bundler-cache: true + + - name: Decode keystore + uses: timheuer/base64-to-file@v1 + id: android_keystore + with: + fileName: "release.jks" + encodedString: ${{ secrets.KEYSTORE_FILE }} + + - name: Add signing configs to build.gradle + run: echo "apply from: 'ci_signing.gradle'" >> mastodon/build.gradle + + - name: Build and deploy to Google Play + run: bundle exec fastlane deploy + env: + KEYSTORE_FILE: ${{ steps.android_keystore.outputs.filePath }} + KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} + SUPPLY_JSON_KEY_DATA: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }} + + - name: Build release apk + run: ./gradlew assembleRelease + env: + KEYSTORE_FILE: ${{ steps.android_keystore.outputs.filePath }} + KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} + + - name: Build githubRelease apk + run: ./gradlew assembleGithubRelease + env: + KEYSTORE_FILE: ${{ steps.android_keystore.outputs.filePath }} + KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} + + - uses: actions/upload-artifact@v4 + with: + path: | + mastodon/build/outputs/apk/*/*.apk + mastodon/build/outputs/mapping/*/mapping.txt \ No newline at end of file diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 61513fcf..0538f8db 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -26,12 +26,6 @@ platform :android do gradle( task: "bundle", build_type: "release", - properties: { - "android.injected.signing.store.file" => ENV["KEYSTORE_FILE"], - "android.injected.signing.store.password" => ENV["KEYSTORE_PASSWORD"], - "android.injected.signing.key.alias" => "key0", - "android.injected.signing.key.password" => ENV["KEYSTORE_PASSWORD"], - } ) upload_to_play_store( changes_not_sent_for_review: true diff --git a/fastlane/metadata/android/en-US/changelogs/86.txt b/fastlane/metadata/android/en-US/changelogs/86.txt new file mode 100644 index 00000000..4be56205 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/86.txt @@ -0,0 +1,3 @@ +- You can now easily share and scan QR codes to quickly find each other +- We've updated the look of the tab bar to better match current platform guidelines +- Various minor usability improvements \ No newline at end of file diff --git a/mastodon/ci_signing.gradle b/mastodon/ci_signing.gradle new file mode 100644 index 00000000..bddf4ff0 --- /dev/null +++ b/mastodon/ci_signing.gradle @@ -0,0 +1,20 @@ +// Included into build.gradle when running in a CI pipeline + +android{ + signingConfigs{ + release{ + keyAlias "key0" + keyPassword System.getenv("KEYSTORE_PASSWORD") + storeFile file(System.getenv("KEYSTORE_FILE")) + storePassword System.getenv("KEYSTORE_PASSWORD") + } + } + buildTypes{ + release{ + signingConfig signingConfigs.release + } + githubRelease{ + signingConfig signingConfigs.release + } + } +} \ No newline at end of file