Merge pull request #658 from hpi-studyu/feat/disable-public-study-inv… #520
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
name: Deploy apps | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
paths: | |
- '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 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3 # do not use head | |
bundler-cache: true | |
- name: Set up java env | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Bundle install for Android Gemfile | |
run: | | |
bundle install | |
timeout-minutes: 5 | |
working-directory: ./app/android | |
- name: Set up flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
cache: true | |
- name: Prepare upload key | |
run: | | |
echo "$STUDYU_ANDROID_KEYSTORE_BASE64" | base64 --decode > app/keystore.jks | |
echo "$STUDYU_KEY_PROPERTIES" > key.properties | |
working-directory: app/android | |
env: | |
STUDYU_ANDROID_KEYSTORE_BASE64: ${{ secrets.STUDYU_ANDROID_KEYSTORE_BASE64 }} | |
STUDYU_KEY_PROPERTIES: ${{ secrets.STUDYU_KEY_PROPERTIES }} | |
- name: Build StudyU app bundle | |
run: flutter build appbundle --release --build-number ${{ github.run_number }} | |
working-directory: ./app | |
- name: Fastlane upload | |
run: bundle exec fastlane deploy_internal | |
working-directory: ./app/android | |
env: | |
PLAY_CREDS_JSON: ${{ secrets.PLAY_CREDS_JSON }} | |
app-store-release: | |
name: Create App Store Release | |
runs-on: macos-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 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3 # do not use head | |
bundler-cache: true | |
- name: Bundle install for iOS Gemfile | |
run: | | |
bundle install | |
timeout-minutes: 5 | |
working-directory: ./app/ios | |
- name: Set up flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
cache: true | |
- name: Get StudyU app version | |
run: | | |
# Read the version of study_app from pubspec.yaml and make it CFBundleShortVersionString compatible | |
# Flutter command needs to be run to clear the initial welcome message | |
flutter config --no-analytics | |
regex="([0-9]+)\.([0-9]+)\.([0-9]+)" | |
app_version=$(flutter pub deps --json | jq -r '.packages[] | select(.name == "studyu_app").version') | |
if [[ $app_version =~ $regex ]]; then | |
short_version_string="STUDYU_APP_VERSION=${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}" | |
echo "$short_version_string" | |
echo "$short_version_string" >> "$GITHUB_ENV" | |
else | |
echo "Version $app_version is not a valid semantic version" | |
exit 1 | |
fi | |
working-directory: ./app | |
- name: Build StudyU ios without codesign | |
run: flutter build ios --release --no-codesign --build-number ${{ github.run_number }} --build-name ${{ env.STUDYU_APP_VERSION }} | |
working-directory: ./app | |
- name: Fastlane upload | |
run: bundle exec fastlane upload_testflight | |
working-directory: ./app/ios | |
env: | |
FASTLANE_APP_IOS_KEY_ID: ${{ secrets.FASTLANE_APP_IOS_KEY_ID }} | |
FASTLANE_APP_IOS_ISSUER_ID: ${{ secrets.FASTLANE_APP_IOS_ISSUER_ID }} | |
FASTLANE_APP_IOS_KEY_CONTENT: ${{ secrets.FASTLANE_APP_IOS_KEY_CONTENT }} | |
FASTLANE_APP_IOS_MATCH_GIT_URL: ${{ secrets.FASTLANE_APP_IOS_MATCH_GIT_URL }} | |
FASTLANE_APP_IOS_MATCH_GIT_PRIVATE_KEY: ${{ secrets.FASTLANE_APP_IOS_MATCH_GIT_PRIVATE_KEY }} | |
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
TEMP_KEYCHAIN_USER: ${{ secrets.TEMP_KEYCHAIN_USER }} | |
TEMP_KEYCHAIN_PASSWORD: ${{ secrets.TEMP_KEYCHAIN_PASSWORD }} |