Skip to content

Commit

Permalink
ci(deploy): modulize android and ios deployment files
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Ruck <git@manuelruck.de>
  • Loading branch information
Manuel Ruck committed Feb 9, 2025
1 parent fca8a3a commit 91ded6b
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 83 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/android.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Android Deploy Steps

on:
workflow_call:
inputs:
app_variant:
type: string
required: true
ci:
type: boolean
required: true

jobs:
setup:
uses: ./.github/workflows/common-setup.yaml
with:
os: ubuntu-latest

android-deploy:
needs: setup
runs-on: ubuntu-latest
env:
APP_VARIANT: ${{ inputs.app_variant }}
CI: ${{ inputs.ci }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Restore Yarn dependencies
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Decrypt GPG secure files
run: |
sudo apt-get install -y gnupg1
echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 google-services.json.gpg
echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 deploy/android/key.json.gpg
echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 deploy/android/democracy2-release-key.keystore.gpg
- name: Build Expo app prebuild
run: yarn expo prebuild

- name: Setup Ruby + Cache Gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: deploy/android

- name: Android Fastlane
run: bundle exec fastlane android internal --env internal
working-directory: ./deploy/android
env:
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
ANDROID_PASS: ${{ secrets.ANDROID_PASS }}
32 changes: 32 additions & 0 deletions .github/workflows/common-setup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Common Setup Steps

on:
workflow_call:
inputs:
os:
required: true
type: string
description: "The runner OS to use"

jobs:
setup:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"

- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
96 changes: 13 additions & 83 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,87 +5,17 @@ on:
branches:
- main

env:
APP_VARIANT: internal
CI: true

jobs:
build:
name: Build & Deploy ${{ matrix.platform }}
strategy:
matrix:
include:
- platform: android
os: ubuntu-latest
- platform: ios
os: macos-latest
runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"

- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn

- name: iOS Encrypt GPG secure files
if: ${{ matrix.platform == 'ios' }}
run: |
brew install gnupg@1.4
echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 google-services.json.gpg
echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 deploy/ios/AuthKey_3Q9U495BMY.p8.gpg
- name: Android Encrypt GPG secure files
if: ${{ matrix.platform == 'android' }}
run: |
sudo apt-get install -y gnupg1
echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 google-services.json.gpg
echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 deploy/android/key.json.gpg
echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 deploy/android/democracy2-release-key.keystore.gpg
- name: Build Expo app prebuild for ${{ matrix.platform }}
run: yarn expo prebuild

- name: iOS Fastlane
if: ${{ matrix.platform == 'ios' }}
run: |
fastlane ios deploy
working-directory: ${{ github.workspace }}/deploy/ios
env:
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_TYPE: appstore
MATCH_FORCE: "true"
FASTLANE_TEAM_ID: A4B84UJD7M

- name: Setup Ruby + Cache Gems
uses: ruby/setup-ruby@v1
if: ${{ matrix.platform == 'android' }}
with:
bundler-cache: true
working-directory: deploy/android

- name: Android Fastlane
if: ${{ matrix.platform == 'android' }}
run: |
bundle exec fastlane android internal --env internal
working-directory: ${{ github.workspace }}/deploy/android
env:
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
ANDROID_PASS: ${{ secrets.ANDROID_PASS }}
ios:
uses: ./.github/workflows/ios.yaml
secrets: inherit
with:
app_variant: internal
ci: true

android:
uses: ./.github/workflows/android.yaml
secrets: inherit
with:
app_variant: internal
ci: true
55 changes: 55 additions & 0 deletions .github/workflows/ios.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: iOS Deploy Steps

on:
workflow_call:
inputs:
app_variant:
type: string
required: true
ci:
type: boolean
required: true

jobs:
setup:
uses: ./.github/workflows/common-setup.yaml
with:
os: macos-latest

ios-deploy:
needs: setup
runs-on: macos-latest
env:
APP_VARIANT: ${{ inputs.app_variant }}
CI: ${{ inputs.ci }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Restore Yarn dependencies
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Decrypt GPG secure files
run: |
brew install gnupg@1.4
echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 google-services.json.gpg
echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 deploy/ios/AuthKey_3Q9U495BMY.p8.gpg
- name: Build Expo app prebuild
run: yarn expo prebuild

- name: iOS Fastlane
run: fastlane ios deploy
working-directory: ./deploy/ios
env:
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_TYPE: appstore
MATCH_FORCE: "true"
FASTLANE_TEAM_ID: A4B84UJD7M

0 comments on commit 91ded6b

Please sign in to comment.