Skip to content

Commit

Permalink
feat: Github Actions build with Fastlane (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrevik authored Nov 3, 2020
1 parent 17468cd commit a042c3b
Show file tree
Hide file tree
Showing 25 changed files with 863 additions and 23 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/build-staging-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build staging Android project
on:
push:
branches:
- master

jobs:
build-ios:
name: Build Android
runs-on: macOS-latest
steps:
- name: Checkout project
uses: actions/checkout@v1
- name: Set global env vars
run: |
echo "BUILD_ID=$(date +%s)" >> $GITHUB_ENV
echo "APP_ENVIRONMENT=staging" >> $GITHUB_ENV
- name: Decrypt env files
run: sh ./scripts/git-crypt-unlock.sh
env:
GIT_CRYPT_KEY: ${{ secrets.GIT_CRYPT_KEY }}
- name: install node v12
uses: actions/setup-node@v1
with:
node-version: 12
- name: Get potential cached node_modules
uses: actions/cache@v2
id: modules-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/patches/**.patch') }}
- name: Install node_modules
if: steps.modules-cache.outputs.cache-hit != 'true'
run: yarn install
- name: Bundle install, fastlane dependencies
run: bundle install
- name: Set environment
run: sh ./scripts/override-environment.sh $APP_ENVIRONMENT
- name: Override native config files
run: sh ./scripts/override-config-files.sh
- name: Get potential cached APK
uses: actions/cache@v2
id: apk-cache
with:
path: 'app-staging.apk'
key: ${{ runner.os }}-android-cache-${{ hashFiles('android/**') }}
- name: Get Android keystore
run: sh ./scripts/android/create-keystore-file.sh
env:
GPG_KEYSTORE_FILE: ${{ secrets.GPG_KEYSTORE_FILE }}
GPG_KEYSTORE_PASS: ${{ secrets.GPG_KEYSTORE_PASS }}
- name: Generate icons
if: steps.apk-cache.outputs.cache-hit != 'true'
run: brew install imagemagick && yarn app-icon generate -i icon.qa.png --platforms=android --rounded none && yarn app-icon generate -i icon.qa.round.png --platforms=android --rounded only
- name: Run fastlane build
if: steps.apk-cache.outputs.cache-hit != 'true'
run: yarn build:android
env:
KEYSTORE_PASS: ${{ secrets.ATB_KEYSTORE_PASS }}
KEY_PASS: ${{ secrets.ATB_KEY_PASS }}
KEY_ALIAS: ${{ secrets.ATB_KEY_ALIAS }}
- name: Replace apk bundle
if: steps.apk-cache.outputs.cache-hit == 'true'
run: sh ./scripts/android/replace-bundle.sh
env:
APK_FILE_NAME: app-staging.apk
KEYSTORE_FILE: keystore.jks
KEYSTORE_PASS: ${{ secrets.ATB_KEYSTORE_PASS }}
KEY_PASS: ${{ secrets.ATB_KEY_PASS }}
KEY_ALIAS: ${{ secrets.ATB_KEY_ALIAS }}
- name: Distribute to AppCenter
run: yarn appcenter:android
env:
APPCENTER_API_KEY: ${{ secrets.APPCENTER_ANDROID_API_KEY }}
- name: Upload bundle and source maps
run: sh ./scripts/android/upload-sourcemaps.sh
env:
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
83 changes: 83 additions & 0 deletions .github/workflows/build-staging-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build staging iOS project
on:
push:
branches:
- master

jobs:
build-ios:
name: Build iOS
runs-on: macOS-latest
steps:
- name: Checkout project
uses: actions/checkout@v1
- name: Set global env vars
run: |
echo "BUILD_ID=$(date +%s)" >> $GITHUB_ENV
echo "APP_ENVIRONMENT=staging" >> $GITHUB_ENV
- name: Decrypt env files
run: sh ./scripts/git-crypt-unlock.sh
env:
GIT_CRYPT_KEY: ${{ secrets.GIT_CRYPT_KEY }}
- name: install node v12
uses: actions/setup-node@v1
with:
node-version: 12
- name: Get potential cached node_modules
uses: actions/cache@v2
id: modules-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/patches/**.patch') }}
- name: Install node_modules
if: steps.modules-cache.outputs.cache-hit != 'true'
run: yarn install
- name: Bundle Install
run: bundle install
- name: Set environment
run: sh ./scripts/override-environment.sh $APP_ENVIRONMENT
- name: Override native config files
run: sh ./scripts/override-config-files.sh
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }}
- name: Get potential cached ipa
uses: actions/cache@v2
id: ipa-cache
with:
path: 'AtB.ipa'
key: ${{ runner.os }}-ios-cache-${{ hashFiles('ios/**') }}
- name: Run fastlane cert match
run: yarn cert:ios
env:
FASTLANE_MATCH_URL: ${{ secrets.FASTLANE_MATCH_URL }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
- name: Generate icons
if: steps.ipa-cache.outputs.cache-hit != 'true'
run: brew install imagemagick && yarn app-icon generate -i icon.qa.png --platforms=ios
- name: Run fastlane build
if: steps.ipa-cache.outputs.cache-hit != 'true'
run: yarn build:ios
- name: Replace ipa bundle
if: steps.ipa-cache.outputs.cache-hit == 'true'
run: sh ./scripts/ios/replace-bundle.sh
env:
IPA_FILE_NAME: 'AtB.ipa'
APP_NAME: 'AtB.app'
CODE_SIGN_IDENTITY: ${{ secrets.IOS_CODE_SIGN_IDENTITY }}
- name: Distribute to AppCenter
run: yarn appcenter:ios
env:
APPCENTER_API_KEY: ${{ secrets.APPCENTER_IOS_API_KEY }}
- name: Create bundle and source maps
if: steps.ipa-cache.outputs.cache-hit != 'true'
run: sh ./scripts/ios/create-sourcemaps.sh
- name: Upload bundle and source maps
run: sh ./scripts/ios/upload-sourcemaps.sh
env:
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
- name: Upload dSYMs
if: steps.ipa-cache.outputs.cache-hit != 'true'
run: sh ./scripts/ios/upload-dsyms.sh
env:
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source "https://rubygems.org"

gem "fastlane"
gem "cocoapods"

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
Loading

0 comments on commit a042c3b

Please sign in to comment.