Skip to content

Commit

Permalink
feat: gen gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxsf committed Mar 25, 2024
1 parent 5e41ac4 commit 1d87230
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 27 deletions.
54 changes: 27 additions & 27 deletions .github/workflows/deploy2io.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
name: sync to github.io
# name: sync to github.io

on:
push:
branches:
- main # default branch
paths:
- '.github/workflows/**'
- '**'
# on:
# push:
# branches:
# - main # default branch
# paths:
# - '.github/workflows/**'
# - '**'

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 # 检出仓库
- uses: actions/setup-node@v3 # 设置node版本
with:
node-version: 16
- run: npm install
- run: npm run build
# jobs:
# build-and-deploy:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3 # 检出仓库
# - uses: actions/setup-node@v3 # 设置node版本
# with:
# node-version: 16
# - run: npm install
# - run: npm run build

- name : Sync
uses : JamesIves/github-pages-deploy-action@v4 # 跨仓库提交代码
with :
branch : main # action 应该部署到的分支。
folder : dist # 操作应该部署的文件夹。
clean: false
repository-name: hellof2e/quark-playground.github.io
token: ${{ secrets.GIT_ACTION }}
target-folder: /
# - name : Sync
# uses : JamesIves/github-pages-deploy-action@v4 # 跨仓库提交代码
# with :
# branch : main # action 应该部署到的分支。
# folder : dist # 操作应该部署的文件夹。
# clean: false
# repository-name: hellof2e/quark-playground.github.io
# token: ${{ secrets.GIT_ACTION }}
# target-folder: /
35 changes: 35 additions & 0 deletions .github/workflows/gen-gh-pages-io.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: deploy

on:
push:
branches: [main] # master 分支有 push 时触发
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
- README.md

jobs:
deploy:
runs-on: ubuntu-latest
steps:

# 下载源码
# 这一步就是检出你的仓库并下载里面的代码到runner中,actions/checkout@v2是官方自己造的轮子,直接拿来用就行
- name: Checkout
uses: actions/checkout@v2

# 打包构建
- name: Build
uses: actions/setup-node@master
with:
node-version: '16.x'
- run: npm install # 安装依赖
- run: npm run build # 打包

# 部署到 GitHub pages
- name: Deploy
uses: peaceiris/actions-gh-pages@v3 # 使用部署到 GitHub pages 的 action
with:
publish_dir: ./dist # 部署打包后的 dist 目录
github_token: ${{ secrets.GITHUB_TOKEN }} # secret 名
# user_name: ${{ secrets.MY_USER_NAME }}
# user_email: ${{ secrets.MY_USER_EMAIL }}
# commit_message: 自动部署 # 部署时的 git 提交信息,自由填写

0 comments on commit 1d87230

Please sign in to comment.