ci: 更新触发url #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 构建并部署 | |
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'docs/**' | |
- '.github/workflows/cf.yml' | |
- 'package.json' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 检出代码 | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 安装 pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: latest | |
- name: 安装依赖 | |
run: pnpm install | |
- name: 更新主题包 | |
run: pnpm update @project-trans/vitepress-theme-project-trans@prerelease | |
- name: 构建项目 | |
run: pnpm build | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: 使用 GitHub App 进行身份验证 | |
id: auth | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ vars.TRIGGER_APP_ID }} | |
private-key: ${{ secrets.TRIGGER_APP_SECRET }} | |
owner: ${{ github.repository_owner }} | |
- name: 触发主仓库的构建工作流 | |
run: | | |
curl -X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${{ steps.auth.outputs.token }}" \ | |
https://api.github.com/repos/trans-archive/archive/actions/workflows/cf.yml/dispatches \ | |
-d '{"ref":"main"}' |