[Feat/#24] native 배포 스크립트 테스트 #43
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 Preview | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} | |
EAS_PROJECT_ID: ${{ secrets.EAS_PROJECT_ID }} | |
ENV_FILE: ${{ secrets.ENV_FILE }} | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Check for EXPO_TOKEN | |
run: | | |
if [ -z "${{ env.EXPO_TOKEN }}" ]; then | |
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions" | |
exit 1 | |
fi | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
run_install: false | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: "pnpm" | |
- name: 🏗 Setup EAS | |
uses: expo/expo-github-action@v8 | |
with: | |
eas-version: latest | |
token: ${{ env.EXPO_TOKEN }} | |
- name: Install Dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Create .env file | |
run: echo "${{ env.ENV_FILE }}" >> .env | |
- name: 🔧 Initialize EAS Project | |
run: yes | eas init --id ${{ env.EAS_PROJECT_ID }} | |
- name: 🚀 Create Preview | |
id: preview | |
uses: expo/expo-github-action/preview@v8 | |
with: | |
command: eas update --auto --branch ${{ github.event.pull_request.head.ref || inputs.branch }} --platform all --message "App Update (#${{ github.event.pull_request.number || github.run_number }})" | |
comment: true | |
- name: 💬 Notify Slack | |
if: success() | |
uses: slackapi/slack-github-action@v1.26.0 | |
with: | |
payload: | | |
{ | |
"text": "Native 앱 Preview 신규 버전 생성 알림", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "🎉 Native 앱 Preview 신규 버전이 생성되었어요!\n\n*PR:* ${{ github.event.pull_request.html_url }}\n*Branch:* ${{ github.event.pull_request.head.ref }}" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ env.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |