Update README.md #21
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: Deploy to gh-pages V2 | |
on: | |
push: | |
branches: | |
- main # 监听 main 分支的更新 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the current project code | |
uses: actions/checkout@v3 | |
- name: Checkout EnrichGTWebsite repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ZhimingYe/EnrichGT_website # 目标仓库地址 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: EnrichGTWebsite # 在本地创建一个目录来存放源项目的文件 | |
- name: Set up Node.js (optional, depending on your project) | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Install dependencies (optional) | |
run: | | |
npm install # 如果需要安装依赖,可以加入此步 | |
- name: Build site (optional, if you need to build your site) | |
run: | | |
# 在这里放置构建你网站的命令,比如: | |
# npm run build | |
# 如果你的网站已经是预构建好的内容,可以跳过此步骤 | |
echo "Build complete" | |
- name: Copy EnrichGTWebsite build to current project | |
run: | | |
mkdir site | |
mkdir site/_site | |
cp -r EnrichGTWebsite/_site/* site/_site/ # 将 EnrichGTWebsite 中构建好的内容复制到目标文件夹 | |
- name: Deploy to gh-pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages # 目标分支 | |
folder: site/_site # 源文件夹 | |
clean: true # 清理目标分支中的其他文件 | |
force_orphan: true # 强制覆盖并创建一个没有历史的孤立分支 | |
token: ${{ secrets.GITHUB_TOKEN }} # GitHub token 用于认证 |