[CI/CD] Preview URL 배포 깨짐 해결 및 원하는 도메인과 연결 #351
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: Auto Sync | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- develop | |
workflow_dispatch: # 수동 실행도 가능하도록 추가 | |
jobs: | |
sync_main: | |
name: Sync forked repository on push to main | |
runs-on: ubuntu-latest | |
if: github.repository == 'JEOLLOGA/JEOLLOGA-CLIENT' && github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.AUTO_SYNC }} | |
- name: Cache Yarn Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.yarn/cache | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install | |
- name: Run Lint Check | |
run: yarn lint | |
- name: Build project | |
run: yarn run build | |
- name: Add remote URL | |
run: | | |
git remote add forked_repo https://seong-hui:${{ secrets.AUTO_SYNC }}@github.com/seong-hui/JEOLLOGA-CLIENT | |
git config user.name seong-hui | |
git config user.email [email protected] | |
- name: Push Changes to forked_repo | |
run: | | |
git push -f forked_repo HEAD:refs/heads/main | |
sync_develop: | |
name: Sync forked repository on push to develop | |
runs-on: ubuntu-latest | |
if: github.repository == 'JEOLLOGA/JEOLLOGA-CLIENT' && github.event_name == 'push' && github.ref == 'refs/heads/develop' | |
steps: | |
- name: Checkout develop | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.AUTO_SYNC }} | |
- name: Cache Yarn Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.yarn/cache | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install | |
- name: Run Lint Check | |
run: yarn lint | |
- name: Build project | |
run: yarn run build | |
- name: Add remote URL | |
run: | | |
git remote add forked_repo https://seong-hui:${{ secrets.AUTO_SYNC }}@github.com/seong-hui/JEOLLOGA-CLIENT | |
git config user.name seong-hui | |
git config user.email [email protected] | |
- name: Push Changes to forked_repo | |
run: | | |
git push -f forked_repo HEAD:refs/heads/develop | |
build_pr: | |
name: Build project on pull_request to develop | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' && github.base_ref == 'develop' | |
steps: | |
- name: Checkout develop | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.AUTO_SYNC }} | |
- name: Cache Yarn Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.yarn/cache | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install | |
- name: Run Lint Check | |
run: yarn lint | |
- name: Build project | |
run: yarn run build |