-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
name: GitHub Actions Build and Deploy Demo | ||
on: | ||
name: Build and Deploy | ||
on: # 监听 master 分支上的 push 事件 | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-latest # 构建环境使用 ubuntu | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
uses: actions/[email protected] | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Install and Build # 下载依赖 打包项目 | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Deploy # 将打包内容发布到 github page | ||
uses: JamesIves/[email protected] # 使用别人写好的 actions | ||
with: # 自定义环境变量 | ||
ACCESS_TOKEN: ${{ secrets.VUE_ADMIN_TEMPLATE }} # VUE_ADMIN_TEMPLATE 是我的 secret 名称,需要替换成你的 | ||
BRANCH: master | ||
FOLDER: dist | ||
REPOSITORY_NAME: woai3c/woai3c.github.io # 这是我的 github page 仓库 | ||
TARGET_FOLDER: github-actions-demo # 打包的文件将放到静态服务器 github-actions-demo 目录下 | ||
|
||
- name: Build and Deploy | ||
uses: JamesIves/github-pages-deploy-action@master | ||
env: | ||
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
BRANCH: gh-pages | ||
FOLDER: build | ||
BUILD_SCRIPT: npm install && npm run build |