heya #33
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: Sync to Vercel Repo | |
| on: | |
| push: | |
| branches: | |
| - testnet | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source repo | |
| uses: actions/checkout@v4 | |
| - name: Configure Git | |
| run: | | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --global user.name "${{ github.actor }}" | |
| git config --global --add safe.directory /github/workspace | |
| - name: Push to destination (Vercel) repo | |
| env: | |
| DESTINATION_REPO: "https://junman140:${{ secrets.API_TOKEN_GITHUB }}@github.com/junman140/USDP-TEST-FRONTEND.git" | |
| run: | | |
| # Try to clone main branch first, if it fails, create the repo structure | |
| if git clone "$DESTINATION_REPO" --branch main --single-branch temp_usdp_test_frontend 2>/dev/null; then | |
| echo "✅ Cloned main branch successfully" | |
| else | |
| echo "⚠️ Repository or main branch doesn't exist, creating..." | |
| mkdir -p temp_usdp_test_frontend | |
| cd temp_usdp_test_frontend | |
| git init | |
| git checkout -b main | |
| git remote add origin "$DESTINATION_REPO" | |
| cd .. | |
| fi | |
| rsync -av --delete --exclude '.git' --exclude '.github/workflows' ./ temp_usdp_test_frontend/ | |
| cd temp_usdp_test_frontend | |
| # Configure git if not already done | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git config user.name "GitHub Actions" | |
| if [ -n "$(git status --porcelain)" ]; then | |
| git add . | |
| git commit -m "Sync source code for Vercel build 🚀 [skip ci]" | |
| git push origin main || git push -u origin main | |
| echo "✅ Synced successfully!" | |
| else | |
| echo "🟢 No changes detected — skipping commit." | |
| fi |