Skip to content

Instantly share code, notes, and snippets.

@Zen-CODE
Last active May 11, 2021 17:22
Show Gist options
  • Save Zen-CODE/c4bb510aecaf63e7d7c2fe161dc9ca82 to your computer and use it in GitHub Desktop.
Save Zen-CODE/c4bb510aecaf63e7d7c2fe161dc9ca82 to your computer and use it in GitHub Desktop.
iOD Deployment for '.github/workflows/cd-workflow.yaml'
name: Frontend Deployment - Staging
on:
push:
branches:
- master
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install yarn dependencies
run: yarn install
- name: Run linter
run: yarn run lint
- name: Run unit tests
run: yarn jest
- name: SonarCloud scan
uses: sonarsource/sonarcloud-github-action@master
with:
projectBaseDir: .
args: >
-Dsonar.organization=kivy
-Dsonar.projectKey=Kivy_launcher-mobile-application
-Dsonar.typescript.lcov.reportPaths=./coverage/lcov.info
-Dsonar.testExecutionReportPaths=./test-report.xml
-Dsonar.sources=.
-Dsonar.coverage.exclusions=**/__tests__/*.js,**/coverage/**,**/node_modules/**,**/babel.config.js,**/jest.setup.js
-Dsonar.host.url=https://sonarcloud.io
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
version-bump:
needs: [validate]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install yarn dependencies
run: yarn install
- name: Configure git for standard-version
run: |
git config --global user.name 'version-bump'
git config --global user.email 'version-bump@users.noreply.github.com'
- name: Update version numbers
run: yarn standard-version
- name: Temporarily disable branch protection
uses: octokit/request-action@v2.x
with:
route: PUT /repos/:repository/branches/master/protection
repository: ${{ github.repository }}
required_status_checks: |
null
enforce_admins: |
null
required_pull_request_reviews: |
null
restrictions: |
null
env:
GITHUB_TOKEN: ${{ secrets.PAT_TEMP_DISABLE_BRANCH_PROTECTION }}
- name: Push updated version numbers back to repo
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Re-enable branch protection
uses: octokit/request-action@v2.x
with:
route: PUT /repos/:repository/branches/master/protection
repository: ${{ github.repository }}
mediaType: |
previews:
- luke-cage
required_status_checks: |
strict: true
contexts: []
enforce_admins: |
null
required_pull_request_reviews: |
required_approving_review_count: 1
restrictions: |
null
env:
GITHUB_TOKEN: ${{ secrets.PAT_TEMP_DISABLE_BRANCH_PROTECTION }}
build-and-deploy-android:
needs: [validate, version-bump]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Setup .env
env:
KIVY_CONFIG_ARB: ${{secrets.KIVY_CONFIG_ARB}}
run: |
touch .env
echo KIVY_CONFIG_ARB=$KIVY_CONFIG_ARB >> .env
- name: Install yarn dependencies
run: yarn install
- name: Install expo-cli
run: sudo npm install -g expo-cli
- name: Authenticate expo-cli
env:
EXPO_USERNAME: ${{secrets.EXPO_USERNAME}}
EXPO_PASSWORD: ${{secrets.EXPO_PASSWORD}}
run: expo login -u $EXPO_USERNAME -p $EXPO_PASSWORD
- name: Build android app bundle on expo
run: expo build:android -t app-bundle
- name: Get google play service account
run: echo '${{ secrets.GOOGLE_PLAY_SA_JSON }}' > service_account.json
- name: Upload android app bundle to google play
run: expo upload:android --latest --key service_account.json --track internal --use-submission-service
build-ios:
needs: [validate, version-bump]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Setup .env
env:
KIVY_CONFIG_ARB: ${{secrets.KIVY_CONFIG_ARB}}
run: |
touch .env
echo KIVY_CONFIG_ARB=$KIVY_CONFIG_ARB >> .env
- name: cat .env
run: cat .env
- name: Install yarn dependencies
run: yarn install
- name: Install expo-cli
run: sudo npm install -g expo-cli
- name: Authenticate expo-cli
env:
EXPO_USERNAME: ${{secrets.EXPO_USERNAME}}
EXPO_PASSWORD: ${{secrets.EXPO_PASSWORD}}
run: expo login -u $EXPO_USERNAME -p $EXPO_PASSWORD
- name: Build ios archive
run: expo build:ios -t archive
deploy-ios:
needs: [validate, version-bump, build-ios]
runs-on: macOS-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Install yarn dependencies
run: yarn install
- name: Install expo-cli
run: sudo npm install -g expo-cli
- name: Authenticate expo-cli
env:
EXPO_USERNAME: ${{secrets.EXPO_USERNAME}}
EXPO_PASSWORD: ${{secrets.EXPO_PASSWORD}}
run: expo login -u $EXPO_USERNAME -p $EXPO_PASSWORD
- name: Pull the latest ios build from expo servers
run: curl -o app.ipa "$(expo url:ipa --non-interactive)"
- name: Install fastlane
run: brew install fastlane
- name: Get app store connect api key
run: echo '${{ secrets.APPLE_APP_STORE_CONNECT_API_KEY_JSON }}' > api_key.json
- name: Upload ios archive to testflight
run: fastlane pilot upload --verbose --ipa "app.ipa" --api_key_path api_key.json --skip_waiting_for_build_processing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment