Merge pull request #138 from codeit-plake/dev #2
This file contains hidden or 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: Mirror and Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }} | |
| NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }} | |
| NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build project | |
| run: npm run build | |
| - name: Checkout target repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: yunhayeon/plake | |
| token: ${{ secrets.GH_PAT }} | |
| path: target-repo | |
| - name: Copy files to target repo | |
| run: | | |
| rm -rf target-repo/* | |
| mkdir -p deploy | |
| ITEMS=(".next" "public" "src" "components.json" "next.config.mjs" \ | |
| "package.json" "package-lock.json" "postcss.config.mjs" \ | |
| "tailwind.config.ts" "tsconfig.json" \ | |
| "sentry.edge.config.ts" "sentry.server.config.ts") | |
| for ITEM in "${ITEMS[@]}"; do | |
| if [ -e "$ITEM" ]; then | |
| cp -r "$ITEM" deploy/ | |
| else | |
| echo "⚠️ Warning: '$ITEM' not found, skipping..." | |
| fi | |
| done | |
| cp -r deploy/* target-repo/ | |
| - name: Commit and push changes | |
| run: | | |
| cd target-repo | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git add . | |
| git commit -m "${{ github.event.commits[0].message }}" || echo "⚠️ No changes to commit" | |
| git push origin main |