Skip to content

LanceJiang is update repo, start building... #68

LanceJiang is update repo, start building...

LanceJiang is update repo, start building... #68

Workflow file for this run

# 1 工作流名称
name: Build and Deploy
# 2 工作流执行名称
run-name: ${{ github.actor }} is update repo, start building...
# 3 触发器
on:
# Runs on pushes targeting the default branch 触发推送目标默认分支
push:
branches: ["master"]
# 允许您从 Actions 选项卡手动运行此工作流
workflow_dispatch:
# 4 设置 GITHUB_TOKEN 的权限以允许部署到 GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# 工作集
jobs:
# 打包 (任务名称1)
build:
# 执行平台
runs-on: ubuntu-latest # 构建环境使用 ubuntu
# 任务步骤
steps:
# 代码仓库的内容拉取
- name: Checkout code (检出代码)
uses: actions/checkout@v3
# 安装 node 环境,并设置版本
- name: Setup Node.js (设置 node 版本)
uses: actions/setup-node@v3
with:
node-version: 18
# 安装依赖
- name: Install dependencies (安装依赖)
run: npm install
# 构建项目
- name: Build (构建)
run: npm run build
# 上传构建产物(actions/upload-artifact@v3 会上传工作流程中的文件)
- name: Upload build artifacts (上传构建产物)
uses: actions/upload-pages-artifact@v2
with:
path: "./dist"
# 部署任务(任务名称2)
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
# 部署 GitHub Pages
- name: Deploy to GitHub Pages(部署到 GitHub Pages)
uses: actions/deploy-pages@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}