👷 update doc ci

This commit is contained in:
yanyongyu
2021-12-02 03:17:10 +08:00
parent 0236746e65
commit 7d8a60b033
64 changed files with 257 additions and 8378 deletions

View File

@ -1,4 +1,4 @@
name-template: 'v$RESOLVED_VERSION 🌈'
name-template: 'Release v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '💥 Breaking Changes'

View File

@ -1,4 +1,4 @@
name: 'NoneBot2 Publish Bot'
name: NoneBot2 Publish Bot
on:
push:
@ -22,6 +22,6 @@ jobs:
with:
token: ${{ secrets.GH_TOKEN }}
base: master
plugin_path: docs/.vuepress/public/plugins.json
bot_path: docs/.vuepress/public/bots.json
adapter_path: docs/.vuepress/public/adapters.json
plugin_path: website/static/plugins.json
bot_path: website/static/bots.json
adapter_path: website/static/adapters.json

View File

@ -1,14 +0,0 @@
name: Release Drafter
on:
push:
branches:
- master
jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

28
.github/workflows/release-github.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Release Drafter
on:
push:
branches:
- master
tags:
- v*
jobs:
update-release-draft:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: release-drafter/release-drafter@v5
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: release-drafter/release-drafter@v5
if: startsWith(github.ref, 'refs/tags/')
with:
name: Release v${GITHUB_REF#refs/tags/} 🌈
tag: ${GITHUB_REF#refs/tags/}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -14,12 +14,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '12'
- run: npm ci
- name: Build Docs
env:
VUEPRESS_BASE: '/docs/'
run: npx vuepress build docs --dest packages/nonebot-plugin-docs/nonebot_plugin_docs/dist
node-version: '16'
- name: Set up Python
uses: actions/setup-python@v2
@ -29,10 +24,14 @@ jobs:
- uses: Gr1N/setup-poetry@v4
- name: Build Docs
run: |
yarn install
yarn build:plugin --out-dir ./packages/nonebot-plugin-docs/nonebot_plugin_docs/dist
- name: Publish Package
run: |
export NONEBOT_VERSION=`poetry version -s`
cd packages/nonebot-plugin-docs/
poetry version $NONEBOT_VERSION
poetry version $(poetry version -s)
poetry build
poetry publish -u ${{secrets.PYPI_USERNAME}} -p ${{secrets.PYPI_PASSWORD}}

View File

@ -1,8 +1,7 @@
name: Build API Doc
name: Release
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
build:
@ -11,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: master
- name: Set up Python
uses: actions/setup-python@v2
@ -34,9 +33,18 @@ jobs:
run: poetry run sphinx-build -M markdown ./docs_build ./build
- name: Copy Files
run: cp -r ./build/markdown/* ./docs/api/
run: cp -r ./build/markdown/* ./website/docs/api/
- uses: actions/upload-artifact@v2
with:
name: docs
path: docs/
- name: Archive Files
run: yarn archive $(poetry version -s)
- name: Push Tag and Release to PyPI
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m ":bookmark: Release $(poetry version -s)"
git tag v$(poetry version -s)
git push --tags
poetry build
poetry publish -u ${{secrets.PYPI_USERNAME}} -p ${{secrets.PYPI_PASSWORD}}

View File

@ -1,36 +0,0 @@
name: Upload API Doc
on:
workflow_run:
workflows: ["Build API Doc"]
types:
- completed
jobs:
upload:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.workflow_run.head_sha }}
token: ${{ secrets.GH_TOKEN }}
- uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: docs
path: docs/
- env:
REF: ${{ github.event.workflow_run.head_branch }}
PR_REPO: ${{ github.event.workflow_run.head_repository.full_name }}
PR_USER: ${{ github.event.workflow_run.head_repository.owner.login }}
run: |
git config user.name $PR_USER
git config user.email $PR_USER@users.noreply.github.com
git add .
git diff-index --quiet HEAD || git commit -m ":memo: update api docs"
git remote add target https://github.com/$PR_REPO.git
git push target HEAD:$REF

View File

@ -2,7 +2,7 @@ name: Build Upload Site
on:
push:
pull_request_target:
pull_request:
jobs:
publish:
@ -22,11 +22,10 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Packages
id: yarn-cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
@ -44,7 +43,6 @@ jobs:
echo "DEPLOY_NAME=${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
echo "PRODUCTION=${{ env.BRANCH_NAME == 'master' }}" >> $GITHUB_ENV
- name: Get Deploy Name
if: github.event_name != 'push'
run: |
@ -54,7 +52,7 @@ jobs:
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.1
with:
publish-dir: './docs/.vuepress/dist'
publish-dir: './website/build'
production-deploy: ${{ env.PRODUCTION }}
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Deploy ${{ env.DEPLOY_NAME }}@${{ github.sha }}'