Skip to content

CI

CI #41

# 这是一个基本的workflow,帮助你开始使用Actions
name: CI
# 控制workflow何时运行
on:
# 在push或pull request事件触发workflow,但仅限于"main"分支
push:
branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
# 允许你从Actions标签手动运行此workflow
workflow_dispatch:
# 设置GITHUB_TOKEN的权限,允许部署到GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# 允许一次并发部署,跳过在进行的运行和最新排队之间的运行。
# 但是,不要取消正在进行中的运行,因为我们希望允许这些生产部署完成。
concurrency:
group: "pages"
cancel-in-progress: false
# 一个workflow运行由一个或多个可以顺序或并行运行的job组成
jobs:
# 此workflow包含一个名为"build"的job
# build:
# # job将在的运行器类型
# runs-on: ubuntu-latest
# # 步骤表示将作为job一部分执行的任务序列
# steps:
# # 检出你的仓库到$GITHUB_WORKSPACE,以便你的job可以访问它
# - name: checkout
# uses: actions/checkout@v4
# - name: Use Node.js 18.x
# uses: actions/setup-node@v3
# with:
# node-version: 18.x
# - name: build
# run: |
# npm install
# npm run build
# rm -rf ./index.html
# cp ./*.html ./dist/
# echo "budil finished"
# - name: Upload dist directory as artifact
# uses: actions/upload-artifact@v4
# with:
# name: github-pages
# path: dist
# - name: npm install and build
# run: |
# gh-pages -d dist
# - name: deploy to GitHub Pages
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./dist
# run: npx gh-pages -d dist
# 使用运行器的shell运行一组命令
# - name: Run a multi-line script
# run: |
# # gh-pages -d dist,
# # git restore index.html,
# # echo test, and deploy your project.
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: build
run: |
npm install
npm run build
rm -rf ./index.html
cp ./*.html ./dist/
echo "budil finished"
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4