Skip to content

Commit

Permalink
ci: update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
northword committed Jun 5, 2024
1 parent f02426b commit a1987fe
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 12 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ci-pr

on:
# pull_request:
# branches:
# - main
workflow_dispatch:

jobs:
upload:
name: 上传运行信息
runs-on: ubuntu-latest
if: github.repository == 'zotero-chinese/styles' && github.event_name == 'pull_request'
steps:
- name: 保存 PR 编号
run: |
echo "${{ github.event.number }}" > pr_num
- name: 上传 PR 编号
uses: actions/upload-artifact@v4
with:
name: pr-num
path: ./pr_num
37 changes: 25 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,57 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
- name: 签出仓库
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
submodules: recursive

- name: Install pnpm
- name: 设置 PNPM
uses: pnpm/action-setup@v3
with:
version: 9

- name: Setup Node
- name: 设置 Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
cache: pnpm

- name: Install deps
- name: 安装依赖项
run: pnpm install

- name: Build
- name: 构建
run: |
pnpm build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: dist
# - name: Deploy
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# branch: gh-pages
# folder: dist

- name: Commit
- name: 提交变更项
uses: EndBug/add-and-commit@v9
with:
# default_author: github_actions
add: "src"
message: "Auto Build Preview"
push: "--set-upstream origin main"
committer_name: GitHub Actions
committer_email: github-actions[bot]@users.noreply.github.com

# send-dispatch:
# name: 请求部署上线
# if: github.repository == 'zotero-chinese/styles' && github.event_name != 'pull_request'
# needs:
# - build
# runs-on: ubuntu-latest
# steps:
# - name: Repository Dispatch
# uses: peter-evans/repository-dispatch@v3
# with:
# token: ${{ secrets.ACCESS_TOKEN }}
# repository: zotero-chinese/website
# event-type: update-content

0 comments on commit a1987fe

Please sign in to comment.