Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat/#14] 배포 스크립트 작성 #17

Merged
merged 11 commits into from
Dec 29, 2024
Prev Previous commit
Next Next commit
chore: add auto increment in workflow
  • Loading branch information
seungdeok committed Dec 23, 2024
commit 1ae10779c7a8582dd88aec64a0355fde047172bf
3 changes: 3 additions & 0 deletions .github/workflows/develop-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Build Development
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
EAS_PROJECT_ID: ${{ secrets.EAS_PROJECT_ID }}
IOS_BUNDLE_ID: ${{ secrets.IOS_BUNDLE_ID }}
ANDROID_PACKAGE_NAME: ${{ secrets.ANDROID_PACKAGE_NAME }}

on:
push:
Expand Down
41 changes: 15 additions & 26 deletions .github/workflows/production-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build Production

permissions:
pull-requests: write
contents: read
contents: write

env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Expand All @@ -11,6 +11,9 @@ env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
EAS_PROJECT_ID: ${{ secrets.EAS_PROJECT_ID }}
IOS_BUNDLE_ID: ${{ secrets.IOS_BUNDLE_ID }}
ANDROID_PACKAGE_NAME: ${{ secrets.ANDROID_PACKAGE_NAME }}

on:
push:
Expand All @@ -36,28 +39,6 @@ jobs:
with:
fetch-depth: 0

- name: Increment Version
id: version
run: |
# package.json 버전 증가
npm version patch -no-git-tag-version
NEW_VERSION=$(node -p "require('./package.json').version")

# app.json 버전도 동일하게 업데이트
jq ".expo.version = \"$NEW_VERSION\"" app.json > app.json.tmp
mv app.json.tmp app.json

# Android & iOS 빌드 번호도 증가
jq ".expo.android.versionCode += 1 | .expo.ios.buildNumber = (((.expo.ios.buildNumber | tonumber) + 1) | tostring)" app.json > app.json.tmp
mv app.json.tmp app.json

echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT

# 변경사항 커밋
git add package.json app.json
git commit -m "chore: bump version to ${NEW_VERSION} [skip ci]"
git tag "v${NEW_VERSION}"

- name: 🏗 Setup EAS
uses: expo/expo-github-action@v8
with:
Expand All @@ -76,12 +57,20 @@ jobs:
eas build --platform all --profile production --non-interactive
eas submit --platform all --profile production --non-interactive

- name: Push Version Changes
# autoIncrement로 업데이트된 버전 가져오기
NEW_VERSION=$(node -p "require('./app.json').expo.version")
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT

- name: Commit Version Changes
if: success()
run: |
git config --global user.email "moeum[bot]@users.noreply.github.com"
git config --global user.name "MOEUM[bot]"
git config --global user.name "moeum[bot]"
git add app.json
git commit -m "chore: update version to ${NEW_VERSION} [skip ci]"
git tag "v${NEW_VERSION}"
git push --follow-tags
env:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Notify Slack
Expand Down