Get rid of duplicate code #44
Workflow file for this run
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: release-workflow | |
on: [push] | |
# TODO: | |
# on: | |
# push: | |
# branches: | |
# - release/* | |
jobs: | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare runner | |
uses: ./.github/actions/prepare-ubuntu-runner | |
- name: Run virtual machine tests | |
run: bundle exec fastlane run_vm_tests | |
build_android: | |
name: Build Android release | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare runner | |
uses: ./.github/actions/prepare-ubuntu-runner | |
- name: Decode and save key.properties | |
run: echo "${{ secrets.ANDROID_KEY_PROPERTIES }}" | base64 -d > ./android/key.properties | |
- name: Decode and save keystore | |
run: echo "${{ secrets.COCKTAILR_UPLOAD_KEYSTORE_JKS }}" | base64 -d > ./android/app/cocktailr-upload-keystore.jks | |
- name: Build release | |
uses: ./.github/actions/build-android | |
with: | |
type: release | |
google_services_json: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-release-apk | |
path: ./build/app/outputs/flutter-apk/app-release.apk | |
build_ios: | |
name: Build iOS release | |
runs-on: macos-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare runner | |
uses: ./.github/actions/prepare-macos-runner | |
- name: Decode and save GoogleServices-Info.plist | |
run: echo "${{ secrets.GOOGLESERVICE_INFO_PLIST }}" | base64 -d > ./ios/Runner/GoogleService-Info.plist | |
- name: Decode and save App Store Connect API key | |
run: echo "${{ secrets.APP_STORE_CONNECT_API_KEY }}" | base64 -d > ./APP_STORE_CONNECT_API_KEY.p8 | |
- name: Set `MATCH_PASSWORD` environment variable | |
run: echo "MATCH_PASSWORD=${{ secrets.MATCH_PASSWORD }}" >> $GITHUB_ENV | |
- name: Build release | |
run: | | |
echo "${{ secrets.CERTIFICATES_REPO_SSH_KEY }}" > private_key | |
chmod 600 private_key | |
ssh-keygen -lf private_key | |
eval "$(ssh-agent -s)" | |
ssh-add private_key | |
mkdir -p ~/.ssh | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
bundle exec fastlane ios build_release | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cocktailr-ipa-folder | |
path: ./build/ios/ipa/ | |
distribute_android: | |
name: Distribute Android release | |
runs-on: ubuntu-latest | |
needs: [build_android, build_ios] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare runner | |
uses: ./.github/actions/prepare-ubuntu-runner | |
- name: Decode and save Firebase App Distribution service account | |
run: echo "${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_JSON }}" | base64 -d > ./FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT.json | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: app-release-apk | |
path: ./build/app/outputs/flutter-apk | |
- name: Distribute release | |
run: bundle exec fastlane android distribute_firebase | |
distribute_ios: | |
name: Distribute iOS release | |
runs-on: ubuntu-latest | |
needs: [build_android, build_ios] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare runner | |
uses: ./.github/actions/prepare-ubuntu-runner | |
- name: Decode and save Firebase App Distribution service account | |
run: echo "${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_JSON }}" | base64 -d > ./FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT.json | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cocktailr-ipa-folder | |
path: ./build/ios/ipa/ | |
- name: Distribute release | |
run: bundle exec fastlane ios distribute_firebase |