-
Notifications
You must be signed in to change notification settings - Fork 2
34 lines (29 loc) · 913 Bytes
/
nodejs.yml
File metadata and controls
34 lines (29 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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