fix: reference secret in env #121
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://medium.com/flutter-community/automating-publishing-your-flutter-apps-to-google-play-using-github-actions-2f67ac582032 | |
name: Flutter Release | |
on: | |
push: | |
branches: | |
- main | |
- gp_build | |
release: | |
types: [published] | |
jobs: | |
release: | |
name: Build and Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '17.x' | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
- name: Install Fastlane dependencies | |
run: | | |
pwd | |
cd android | |
bundle install | |
cd .. | |
- name: Check gpg version | |
run: gpg --version | |
- name: Decrypting Keystore file | |
env: | |
GPG_PASS: ${{ secrets.GPG_PASS }} | |
run: | | |
cd android/app | |
keyFile=key.jks | |
gpg -d --passphrase "$GPG_PASS" --batch $keyFile.asc > $keyFile | |
- name: Decrypting key.properties file | |
env: | |
GPG_PASS: ${{ secrets.GPG_PASS }} | |
run: | | |
cd ../ | |
keyPropFile=key.properties | |
gpg -d --passphrase "$GPG_PASS" --batch $keyPropFile.asc > $keyPropFile | |
- name: Decrypting Fastlane Secret file | |
env: | |
GPG_PASS: ${{ secrets.GPG_PASS }} | |
run: | | |
pwd | |
cd android | |
file=fastlane-secret.json | |
gpg -d --passphrase "$GPG_PASS" --batch $file.asc > $file | |
- name: Testing Fastlane installation | |
run: | | |
pwd | |
cd android | |
bundle update fastlane | |
bundle exec fastlane run validate_play_store_json_key | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
cache: true | |
# optional parameters follow | |
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache | |
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path | |
pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies | |
pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path | |
- run: flutter --version | |
- run: flutter pub get | |
- run: flutter build appbundle | |
- run: flutter build apk | |
#- name: Upload build artifacts | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: app-release-bundle | |
# path: | | |
# build/app/outputs/bundle/release/app-release.aab | |
# build/app/outputs/flutter-apk/app-release.apk | |
#- name: Deploy Google Play | |
# run: | | |
# pwd | |
# cd android | |
# bundle exec fastlane production_appbundle |