Skip to content

[Feat] fastlane을 이용한 배포 자동화 #1

[Feat] fastlane을 이용한 배포 자동화

[Feat] fastlane을 이용한 배포 자동화 #1

Workflow file for this run

name: Fastlane CI/CD
on:
workflow_dispatch:
inputs:
lane:
description: 'Fastlane lane to run'
required: true
default: 'build_qa_apk'
type: choice
options:
- build_qa_apk
- build_release_apk
- build_release_aab
- deploy_internal_test
- ci_build
environment:
description: 'Build environment'
required: true
default: 'qa'
type: choice
options:
- qa
- production
push:
branches:
- develop
- main
- master
pull_request:
branches:
- develop
- main
- master
jobs:
fastlane:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Install dependencies
run: |
bundle install
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup environment variables
env:
DEV_BASE_URL: ${{ secrets.DEV_BASE_URL }}
PROD_BASE_URL: ${{ secrets.PROD_BASE_URL }}
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
NAVER_MAPS_CLIENT_ID: ${{ secrets.NAVER_MAPS_CLIENT_ID }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
GOOGLE_SERVICE: ${{ secrets.GOOGLE_SERVICE }}
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
run: |
echo "Environment variables set"
- name: Run fastlane
env:
DEV_BASE_URL: ${{ secrets.DEV_BASE_URL }}
PROD_BASE_URL: ${{ secrets.PROD_BASE_URL }}
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
NAVER_MAPS_CLIENT_ID: ${{ secrets.NAVER_MAPS_CLIENT_ID }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
GOOGLE_SERVICE: ${{ secrets.GOOGLE_SERVICE }}
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
bundle exec fastlane ${{ github.event.inputs.lane }} environment:${{ github.event.inputs.environment }}
else
bundle exec fastlane ci_build
fi
- name: Upload APK artifact
if: |
github.event_name == 'workflow_dispatch' &&
(contains(github.event.inputs.lane, 'apk') || github.event.inputs.lane == 'build_qa_apk')
uses: actions/upload-artifact@v4
with:
name: app-apk
path: |
app/build/outputs/apk/**/*.apk
retention-days: 7
- name: Upload AAB artifact
if: |
github.event_name == 'workflow_dispatch' &&
(contains(github.event.inputs.lane, 'aab') || github.event.inputs.lane == 'build_release_aab' || github.event.inputs.lane == 'deploy_internal_test')
uses: actions/upload-artifact@v4
with:
name: app-aab
path: |
app/build/outputs/bundle/**/*.aab
retention-days: 30
- name: Slack notification
if: always()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: workflow,commit,repo,author,job,ref,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}