new version #131
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
on: | |
push: | |
branches: | |
- main | |
# 允许你从 Actions 选项卡手动运行此工作流程 | |
workflow_dispatch: | |
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列 | |
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成 | |
concurrency: | |
group: pages | |
cancel-in-progress: false | |
permissions: | |
contents: write | |
pull-requests: write | |
name: release-please | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
outputs: | |
release_created: ${{ steps.release-output.outputs.release_created }} | |
prs_created: ${{ steps.release-output.outputs.prs_created }} | |
is_published: ${{ steps.release-output.outputs.is_published }} | |
steps: | |
- name: Check event type | |
id: check_event | |
run: | | |
echo "EventName: ${{ github.event_name }}" | |
echo "HeadRef: ${{ github.head_ref }}" | |
- uses: googleapis/release-please-action@v4 | |
id: release | |
name: release | |
with: | |
# this assumes that you have created a personal access token | |
# (PAT) and configured it as a GitHub action secret named | |
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important). | |
token: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
# this is a built-in strategy in release-please, see "Action Inputs" | |
# for more options | |
release-type: node | |
- name: Release Output | |
id: release-output | |
# prs_created 是否拉取, pull-request 没有拉取 | |
run: | | |
echo "release_created=${{ steps.release.outputs.release_created }}" >> "$GITHUB_OUTPUT" | |
echo "prs_created=${{ steps.release.outputs.prs_created }}" >> "$GITHUB_OUTPUT" | |
echo "is_published=${{ steps.release.outputs.releases_created }}" >> "$GITHUB_OUTPUT" | |
check-release: | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- name: Check Release Created | |
id: check-release | |
run: | | |
echo "release: ${{ toJson(needs.release.outputs) }}" | |
deploy-doc: | |
runs-on: ubuntu-latest | |
needs: release | |
if: needs.release.outputs.prs_created == 'true' | |
strategy: | |
matrix: | |
node-version: [21] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache Node Modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Setup Pnpm | |
id: setup-pnpm | |
uses: pnpm/action-setup@v3 | |
- name: Install Dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: pnpm install | |
- name: Build Site | |
run: pnpm docs:build | |
- name: Deploy Site | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/.vitepress/dist | |
deploy_key: ${{ secrets.DEPLOY_KEY }} |