fix/cicd: try to deploy to github pages #2
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: React Starter For GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
Build: | |
# 👉🏻 install + build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v2 | |
- name: setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.18' | |
- run: npm install && npm run build | |
# 上传打包好的文件,所以下一步可以使用 | |
- name: upload files | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-pages | |
path: build | |
retention-days: 1 | |
Deploy: | |
# 👉🏻 deploy to github pages | |
needs: Build # 确保build 阶段完成 | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v2 | |
- name: download build files | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-pages | |
path: build | |
- name: deploy | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: build | |
token: "${{ secrets.EXAMPLES202312 }}" |