👷 update ci workflow

This commit is contained in:
yanyongyu 2022-02-14 21:01:39 +08:00
parent 257c49466f
commit 8f38fc5795
No known key found for this signature in database
GPG Key ID: 796D8A7FB73396EB
7 changed files with 100 additions and 97 deletions

View File

@ -0,0 +1,11 @@
name: Build API Doc
description: Build API Doc
runs:
using: "composite"
steps:
- run: |
poetry run nb-autodoc nonebot
cp -r ./build/nonebot/* ./website/docs/api/
yarn prettier
shell: bash

View File

@ -1,5 +1,16 @@
header: |
### Documentation
See: https://v2.nonebot.dev
template: |
### 💫 Changes
$CHANGES
category-template: "### $TITLE"
name-template: "Release v$RESOLVED_VERSION 🌈"
tag-template: "v$RESOLVED_VERSION"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
categories:
- title: "💥 Breaking Changes"
labels:
@ -13,14 +24,15 @@ categories:
- "fix"
- "bugfix"
- "bug"
- title: "📝 Documentation"
labels:
- "documentation"
- title: "🍻 Plugin Publish"
label: "Plugin"
- title: "🍻 Bot Publish"
label: "Bot"
- title: "🍻 Adapter Publish"
label: "Adapter"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
@ -32,11 +44,3 @@ version-resolver:
labels:
- "patch"
default: patch
template: |
## Documentation
See: https://v2.nonebot.dev
## 💫 Changes
$CHANGES

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

@ -0,0 +1,66 @@
name: Release Drafter
on:
push:
branches:
- master
tags:
- v*
jobs:
update-release-draft:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python Environment
uses: ./.github/actions/setup-python
- name: Setup Node Environment
uses: ./.github/actions/setup-node
- name: Build API Doc
uses: ./.github/actions/build-api-doc
- run: |
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: release-drafter/release-drafter@v5
id: release-drafter
with:
name: Release ${{ env.TAG_NAME }} 🌈
tag: ${{ env.TAG_NAME }}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Publish Package
run: |
poetry build
poetry publish -u ${{secrets.PYPI_USERNAME}} -p ${{secrets.PYPI_PASSWORD}}
gh release upload --clobber ${{ env.TAG_NAME }} dist/*.tar.gz dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Publish Doc Package
run: |
yarn build:plugin --out-dir ../packages/nonebot-plugin-docs/nonebot_plugin_docs/dist
export NONEBOT_VERSION=`poetry version -s`
cd packages/nonebot-plugin-docs/
poetry version $NONEBOT_VERSION
poetry build
poetry publish -u ${{secrets.PYPI_USERNAME}} -p ${{secrets.PYPI_PASSWORD}}
gh release upload --clobber ${{ env.TAG_NAME }} dist/*.tar.gz dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

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

View File

@ -1,34 +0,0 @@
name: Release Nonebot Plugin Docs
on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python Environment
uses: ./.github/actions/setup-python
- name: Setup Node Environment
uses: ./.github/actions/setup-node
- name: Install and build
run: |
poetry run sphinx-build -M markdown ./docs_build ./build
cp -r ./build/markdown/* ./website/docs/api/
yarn prettier
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 build
poetry publish -u ${{secrets.PYPI_USERNAME}} -p ${{secrets.PYPI_PASSWORD}}

View File

@ -19,18 +19,13 @@ jobs:
- name: Setup Node Environment
uses: ./.github/actions/setup-node
- name: Build Doc
run: poetry run sphinx-build -M markdown ./docs_build ./build
- name: Copy Files
run: cp -r ./build/markdown/* ./website/docs/api/
- name: Build API Doc
uses: ./.github/actions/build-api-doc
- name: Archive Files
run: |
yarn prettier
yarn archive $(poetry version -s)
run: yarn archive $(poetry version -s)
- name: Push Tag and Release to PyPI
- name: Push Tag
run: |
git config user.name github-actions
git config user.email github-actions@github.com
@ -38,5 +33,3 @@ jobs:
git commit -m ":bookmark: Release $(poetry version -s)"
git tag v$(poetry version -s)
git push && git push --tags
poetry build
poetry publish -u ${{secrets.PYPI_USERNAME}} -p ${{secrets.PYPI_PASSWORD}}

View File

@ -26,12 +26,11 @@ jobs:
- name: Setup Node Environment
uses: ./.github/actions/setup-node
- name: Install and build
run: |
poetry run nb-autodoc nonebot
cp -r ./build/nonebot/* ./website/docs/api/
yarn prettier
yarn build
- name: Build API Doc
uses: ./.github/actions/build-api-doc
- name: Build Doc
run: yarn build
- name: Get Branch Name
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV