Merge pull request #33 from wildlifeai/terminal-fixes #119
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: Build and Deploy to App Distribution and Testflight | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "*" | |
jobs: | |
extract-metadata: | |
name: Extract app metadata | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.extract-metadata.outputs.version }} | |
release_notes: ${{ steps.extract-metadata.outputs.release_notes }} | |
steps: | |
- name: Extract version and release notes | |
id: extract-metadata | |
run: | | |
VERSION="${{ github.ref_name }}" | |
echo "Original version: $VERSION" | |
VERSION="${VERSION#"v"}" | |
echo "Processed version: $VERSION" | |
echo "::set-output name=version::$VERSION" | |
RELEASE_NOTES=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}" | jq -r '.body') | |
echo "Release notes: $RELEASE_NOTES" | |
RELEASE_NOTES="${RELEASE_NOTES//'%'/'%25'}" | |
RELEASE_NOTES="${RELEASE_NOTES//$'\n'/'%0A'}" | |
RELEASE_NOTES="${RELEASE_NOTES//$'\r'/'%0D'}" | |
echo "::set-output name=release_notes::$RELEASE_NOTES" | |
ios-build: | |
needs: extract-metadata | |
environment: development | |
name: iOS development build | |
runs-on: macos-latest | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/cancel-workflow-action@0.12.0 | |
- name: Checkout repo from branch | |
uses: actions/checkout@v3 | |
- name: create-json | |
id: add-firebase-credentials | |
uses: jsdaniell/create-json@v1.2.2 | |
with: | |
name: "wildlife-watcher-service-account.json" | |
json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} | |
dir: "./fastlane" | |
- name: Add release notes | |
run: | | |
echo -n "${{ needs.extract-metadata.outputs.release_notes }}" > ./release_notes.txt | |
- name: Copy App Store Provisioning certificate | |
run: echo -n "${{ secrets.IOS_CERT_PROVISION }}" | base64 --decode > ./fastlane/profile.mobileprovision | |
- name: Copy Testers Provisioning certificate | |
run: echo -n "${{ secrets.IOS_TESTERS_PROVISION }}" | base64 --decode > ./fastlane/testers.mobileprovision | |
- name: Copy private key | |
run: echo -n "${{ secrets.IOS_CERT_PRIVATE_KEY }}" | base64 --decode > ./fastlane/cert.p12 | |
- name: Copy Google Services plist file | |
run: echo -n "${{ secrets.IOS_GOOGLE_SERVICES_PLIST }}" | base64 --decode > ./ios/GoogleService-Info.plist | |
- name: Install npm dependency | |
run: npm install | |
- name: Install bundler | |
run: gem install bundler -v 2.4.10 | |
- name: Install gem plugins | |
run: bundle install | |
- name: Install dependencies with CocoaPods | |
run: cd ios && bundle exec pod install && cd .. | |
- name: Run fastlane | |
run: bundle exec fastlane ios build_release | |
env: | |
IOS_CERT_PASSWORD: ${{ secrets.IOS_CERT_PASSWORD }} | |
IOS_KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }} | |
APP_VERSION: ${{ needs.extract-metadata.outputs.version }} | |
APP_ID: ${{ vars.APP_ID_IOS }} | |
TESTERS: ${{ vars.TESTERS }} | |
android-build: | |
needs: extract-metadata | |
environment: development | |
name: Android development build | |
runs-on: ubuntu-latest | |
container: | |
image: reactnativecommunity/react-native-android | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/cancel-workflow-action@0.12.0 | |
- name: Checkout repo from branch | |
uses: actions/checkout@v3 | |
- name: create-json | |
id: add-firebase-credentials | |
uses: jsdaniell/create-json@v1.2.2 | |
with: | |
name: "wildlife-watcher-service-account.json" | |
json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} | |
dir: "./fastlane" | |
- name: Add release notes | |
run: echo -n "${{ needs.extract-metadata.outputs.release_notes }}" > ./release_notes.txt | |
- name: create-json | |
id: add-android-credentials | |
uses: jsdaniell/create-json@v1.2.2 | |
with: | |
name: "google-services.json" | |
json: ${{ secrets.ANDROID_GOOGLE_SERVICES_JSON }} | |
dir: "./android/app" | |
- name: Copy keystore file | |
run: echo -n "${{ secrets.ANDROID_RELEASE_KEYSTORE }}" | base64 --decode > ./android/keystores/release.keystore | |
- name: Copy keystore properties file | |
run: echo -n "${{ secrets.ANDROID_RELEASE_KEYSTORE_PROPS }}" | base64 --decode > ./android/keystores/release.keystore.properties | |
- name: Install npm dependency | |
run: npm install | |
- name: Install bundler | |
run: | | |
gem install bundler -v 2.4.10 | |
- name: Install gem plugins | |
run: | | |
bundle install | |
- name: Run fastlane | |
run: | | |
bundle exec fastlane android build_release | |
env: | |
APP_VERSION: ${{ needs.extract-metadata.outputs.version }} | |
APP_CODE_VERSION: ${{ github.run_number }} | |
APP_ID: ${{ vars.APP_ID_ANDROID }} | |
TESTERS: ${{ vars.TESTERS }} |