Skip to content

Update package.json

Update package.json #2

Workflow file for this run

name: GitHub Actions Build and Deploy Demo
on: # 指定触发workflow的条件,这里是指定了每push一次到main分支,则触发一次
push:
branches:
- main
jobs: # workflows文件主体,可以指定一个或者多个,这里指定了一个job - build-and-deploy
build-and-deploy:
runs-on: ubuntu-latest # 在最新的ubuntu上运行
steps: # 指定每个job的运行步骤
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16.14.0'
- name: Checkout # 步骤名称
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false
- name: Install and Build
run: | # 该步骤要运行的命令,这里就是部署react 的命令
npm install
npm run build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3 # 执行一些公开的action
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} # 这里是我们刚刚创建密钥的变量名称
BRANCH: gh-pages
FOLDER: build