|
| 1 | +name: 🚀🤖 Bundle and deploy Sweyer to Google Play |
| 2 | +description: Bundles and deploys Sweyer to Google Play |
| 3 | + |
| 4 | +inputs: |
| 5 | + flutter_channel: |
| 6 | + required: false |
| 7 | + default: "stable" |
| 8 | + description: The channel of the Flutter used to build Sweyer with. |
| 9 | + flutter_version: |
| 10 | + required: false |
| 11 | + default: "3.7.12" |
| 12 | + description: The version of Flutter used to build Sweyer with. |
| 13 | + testing_arguments: |
| 14 | + required: false |
| 15 | + default: "" |
| 16 | + description: Optional additional arguments to the flutter test command.\\ |
| 17 | + ruby_version: |
| 18 | + required: false |
| 19 | + default: 3.3.0 |
| 20 | + |
| 21 | +runs: |
| 22 | + using: "composite" |
| 23 | + steps: |
| 24 | + - name: 🐦 Setup Flutter |
| 25 | + uses: subosito/flutter-action@v2 |
| 26 | + with: |
| 27 | + flutter-version: ${{inputs.flutter_version}} |
| 28 | + channel: ${{inputs.flutter_channel}} |
| 29 | + cache: true |
| 30 | + |
| 31 | + - name: 💎 Set up ruby env |
| 32 | + uses: ruby/setup-ruby@v1 |
| 33 | + with: |
| 34 | + ruby-version: ${{inputs.ruby_version}} |
| 35 | + bundler-cache: true |
| 36 | + |
| 37 | + - name: ⚙️ Decode Keystore File |
| 38 | + uses: timheuer/base64-to-file@v1 |
| 39 | + id: android_keystore |
| 40 | + with: |
| 41 | + fileName: "keystore.jks" |
| 42 | + encodedString: ${{ secrets.ANDROID_KEYSTORE_FILE }} |
| 43 | + |
| 44 | + - name: Generate keystore.properties |
| 45 | + run: | |
| 46 | + cat <<EOF > keystore.properties |
| 47 | + storePassword:${{ secrets.ANDROID_KEYSTORE_PASSWORD }} |
| 48 | + keyPassword:${{ secrets.ANDROID_KEY_PASSWORD }} |
| 49 | + keyAlias:${{ secrets.ANDROID_KEY_ALIAS }} |
| 50 | + storeFile:${{ steps.android_keystore.outputs.filePath }} |
| 51 | + EOF |
| 52 | +
|
| 53 | + - name: 📖 Read app version |
| 54 | + uses: NiklasLehnfeld/flutter-version-number-action@main |
| 55 | + id: read-version |
| 56 | + with: |
| 57 | + file-path: pubspec.yaml |
| 58 | + |
| 59 | + - name: 🪓 Split app version |
| 60 | + uses: winterjung/split@v2 |
| 61 | + id: splitted-version |
| 62 | + with: |
| 63 | + msg: ${{ steps.read-version.outputs.version-number }} |
| 64 | + separator: '+' |
| 65 | + |
| 66 | + - name: 🏗️ Build AAB |
| 67 | + run: | |
| 68 | + tools/build_android_bundle.sh |
| 69 | +
|
| 70 | + - name: ✍ Rename APK |
| 71 | + run: | |
| 72 | + mv ${{ github.workspace }}/build/app/outputs/bundle/release/app-release.aab ${{ github.workspace }}/build/app/outputs/bundle/release/sweyer@${{ steps.read-version.outputs.version-number }}.aab |
| 73 | + |
| 74 | + - name: 🏗️ Build APK |
| 75 | + run: | |
| 76 | + tools/build_android_apk.sh |
| 77 | +
|
| 78 | + - name: ✍ Rename APK |
| 79 | + run: | |
| 80 | + mv ${{ github.workspace }}/build/app/outputs/bundle/release/app-release.apk ${{ github.workspace }}/build/app/outputs/bundle/release/sweyer@${{ steps.read-version.outputs.version-number }}.apk |
| 81 | +
|
| 82 | + - name: ⚙️ Decode Service Account Key JSON File |
| 83 | + uses: timheuer/base64-to-file@v1 |
| 84 | + id: android_service_account_json_file |
| 85 | + with: |
| 86 | + fileName: "androidServiceAccount.json" |
| 87 | + encodedString: ${{ secrets.GPLAY_FASTLANE_SERVICE_ACCOUNT_KEY_JSON }} |
| 88 | + |
| 89 | + - name: 🚀🤖 Build & deploy Android release |
| 90 | + run: bundle exec fastlane android beta |
| 91 | + env: |
| 92 | + FASTLANE_ANDROID_JSON_KEY_FILE: ${{ steps.android_service_account_json_file.outputs.filePath }} |
| 93 | + |
| 94 | + - name: 📁 Zip symbols |
| 95 | + id: zip-symbols |
| 96 | + run: | |
| 97 | + zip -r symbols.zip build/app/outputs/symbols/ |
| 98 | +
|
| 99 | + - name: 📁 Upload build artifacts |
| 100 | + uses: actions/upload-artifact@v3 |
| 101 | + with: |
| 102 | + name: assets |
| 103 | + path: | |
| 104 | + symbols.zip |
| 105 | + ${{ github.workspace }}/build/app/outputs/bundle/release |
| 106 | + ${{ github.workspace }}/build/app/outputs/flutter-apk |
| 107 | +
|
| 108 | + - name: 📝 Draft a GitHub release |
| 109 | + uses: softprops/action-gh-release@v2 |
| 110 | + with: |
| 111 | + name: ${{ steps.splitted-version.outputs._0 }} |
| 112 | + tag_name: ${{ steps.splitted-version.outputs._0 }} |
| 113 | + draft: true |
| 114 | + fail_on_unmatched_files: true |
| 115 | + generate_release_notes: true |
| 116 | + files: | |
| 117 | + symbols.zip |
| 118 | + ${{ github.workspace }}/build/app/outputs/bundle/release |
| 119 | + ${{ github.workspace }}/build/app/outputs/flutter-apk |
| 120 | +
|
| 121 | + # - name: 🧪 Run Tests |
| 122 | + # shell: bash |
| 123 | + # run: flutter test --no-pub --test-randomize-ordering-seed random ${{inputs.testing_arguments}} |
| 124 | + |
| 125 | + # - name: 📁 Save golden test failures artifacts |
| 126 | + # if: always() |
| 127 | + # uses: actions/upload-artifact@v3 |
| 128 | + # with: |
| 129 | + # name: golden-test-failures |
| 130 | + # path: test/golden/failures |
| 131 | + # if-no-files-found: ignore |
0 commit comments