Skip to content

Update deploy-apps.yml #379

Update deploy-apps.yml

Update deploy-apps.yml #379

Workflow file for this run

name: Deploy apps
on:
push:
branches:
- main
- dev
# todo remove
- chore/upgrade-package-deployment
paths:
# todo remove
- '**'
- 'app/**'
- 'core/**'
- 'flutter_common/**'
workflow_dispatch:
concurrency:
group: ${{ github.ref }}-deploy-apps
cancel-in-progress: true
jobs:
play-store-release:
name: Create Play Store Release
runs-on: ubuntu-latest
steps:
- name: Await potential publishing on Pub.dev
uses: johannesvedder/await-workflow@v1
with:
workflowId: publish_pubdev.yml
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up ruby env
# run: |
# sudo apt-get update
# sudo snap install ruby --classic
# bundle install
# working-directory: ./app/android
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3 # head
bundler-cache: false
working-directory: ./app/android
- name: Set up flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true # todo does not seem to work
- name: Cache flutter version
run: |
flutter_version=$(flutter --version)
flutter_version_hash=$(flutter --version | sha256sum | awk '{print $1}')
echo "Flutter version: $flutter_version"
echo "Flutter version hash: $flutter_version_hash"
echo "flutter_version_hash=$flutter_version_hash" >> $GITHUB_ENV
# todo where are decrypted files used?
- name: Decrypt files
id: decrypt_files
run: |
ls -la
echo "${{ secrets.STUDYU_ANDROID_KEYSTORE }}" > keystore.jks.asc
gpg -d --passphrase "${{ secrets.STUDYU_ANDROID_KEYSTORE_PASSWORD }}" --batch keystore.jks.asc > android/app/studyu-keystore.jks
echo "${{ secrets.STUDYU_KEY_PROPERTIES}}" > android/key.properties
ls -la
# cat app/android/key.properties
cd android/
bundle install
bundle exec fastlane actions
working-directory: ./app
- name: Restore StudyU app bundle cache
id: cache-studyu-app-bundle-restore
uses: actions/cache/restore@v4
with:
path: app/build/app/outputs/bundle/release/app-release.aab
# todo key also needs to involve decrypted files
key: flutter_v${{ env.flutter_version_hash }}-${{ hashFiles('**/pubspec.lock') }}-${{ runner.os }}
restore-keys: |
flutter_v${{ env.flutter_version_hash }}-${{ hashFiles('**/pubspec.lock') }}-
- name: Build StudyU app bundle
if: steps.cache-studyu-app-bundle-restore.outputs.cache-hit != 'true'
# todo add --release
run: |
flutter build appbundle --release --build-number ${{ github.run_number }}
working-directory: ./app
- name: Cache StudyU app bundle
id: cache-studyu-app-bundle-save
uses: actions/cache/save@v4
with:
path: app/build/app/outputs/bundle/release/app-release.aab
key: ${{ steps.cache-studyu-app-bundle-restore.outputs.cache-primary-key }}
- name: Fastlane upload
run: bundle exec fastlane deploy_internal
working-directory: ./app/android
env:
PLAY_CREDS_JSON: ${{ secrets.PLAY_CREDS_JSON }}