Skip to content

fengyangfifa are tigger ci/cd action #1

fengyangfifa are tigger ci/cd action

fengyangfifa are tigger ci/cd action #1

Workflow file for this run

name: ci/cd for deployment
run-name: ${{ github.actor }} are tigger ci/cd action
on:
push:
branches: ["main"]
# 必须添加下列权限
permissions:
contents: read
pages: write
id-token: write
# 限制并发,当触发新的工作流时,取消之前的工作流
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo code
uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Cache node modules
id: cache-npm
# 缓存node_modules
uses: actions/cache@v4
with:
path: './node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
# 命中缓存就跳过安装依赖
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: install dependencies
run: npm install
- name: build project
run: npm run build
- name: upload build file
uses: actions/upload-pages-artifact@v3
with:
# 指定上传文件夹
path: './dist'
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: deploy to github pages
uses: actions/deploy-pages@v4