name: Google Play release on: push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' jobs: deploy_android: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Setup Java uses: actions/setup-java@v1 with: java-version: 11.x - name: Setup Ruby uses: ruby/setup-ruby@v1 with: ruby-version: '3' - name: Setup Flutter uses: subosito/flutter-action@v1 with: channel: 'stable' flutter-version: '2.8.x' - name: Decrypt config files run: | cd ./fastlane/metadata/envfiles chmod +x ./decrypt_secrets.sh ./decrypt_secrets.sh env: DECRYPTKEY_PLAYSTORE: ${{ secrets.DECRYPTKEY_PLAYSTORE }} DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }} DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }} - name: Flutter info run: | dart --version flutter --version - name: Install Flutter dependencies run: flutter pub get - name: Extract version information id: get_version run: | echo ::set-output name=VERSION_V::$(echo $GITHUB_REF | cut -d / -f 3) echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3 | cut -c 2-) echo ::set-output name=BUILD::$(flutter pub run cider version | cut -d '+' -f 2) # Note: the original tag that triggered the workflow is in the form vX.Y.Z # but the pubspec.yaml is committed in the commit after that one. # Since we need the tag to point to the correct commit for other workflows # such as f-droid we need a way to correct it. Only moving the tag # would not work, as it would trigger this workflow again. So as # a workaround, we use the v-tag to trigger this workflow, add a new # one without the v and push it. - name: Bump version run: | flutter pub run cider version ${{ steps.get_version.outputs.VERSION }}+${{ steps.get_version.outputs.BUILD }} flutter pub run cider bump build git config user.name Github-actions git config user.email github-actions@github.com git add . git commit -m "Bump version to $( flutter pub run cider version )" git tag ${{ steps.get_version.outputs.VERSION }} git push origin HEAD:master --tags git push origin --delete ${{ steps.get_version.outputs.VERSION_V }} - name: Build AAB run: flutter build appbundle --release env: WGER_API_KEY: ${{ secrets.WGER_API_KEY }} - name: Upload build to Play Store uses: maierj/fastlane-action@v2.1.0 with: lane: production - name: Make Github release uses: softprops/action-gh-release@v1 with: files: build/app/outputs/bundle/release/app-release.aab tag_name: ${{ steps.get_version.outputs.VERSION }} body_path: CHANGELOG.md