Merge pull request #147 from redhat123456/main #202
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: Deploy to Another Repo with Force Push | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: MY_DEPLOY_TOKEN | |
| steps: | |
| - name: Checkout source repo | |
| uses: actions/checkout@v4 | |
| - name: Build project | |
| run: | | |
| npm install | |
| npm run build | |
| - name: Clone target repo | |
| env: | |
| DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} | |
| run: | | |
| git clone --branch main https://x-access-token:${DEPLOY_TOKEN}@github.com/FEMATHS/FEMATHS.github.io.git target-repo | |
| rm -rf target-repo/* | |
| cp -r build/* target-repo/ | |
| cd target-repo | |
| git config user.name "redhat123456" | |
| git config user.email "1907065810@qq.com" | |
| git add . | |
| git commit -m "Deploy via GitHub Actions (force push)" || echo "No changes to commit" | |
| git push -f origin main |