From 8f38fc57950d27f2b1a56a63f23a46b5fd4fee72 Mon Sep 17 00:00:00 2001 From: yanyongyu <42488585+yanyongyu@users.noreply.github.com> Date: Mon, 14 Feb 2022 21:01:39 +0800 Subject: [PATCH] :construction_worker: update ci workflow --- .github/actions/build-api-doc/action.yml | 11 ++++ .github/release-drafter.yml | 24 +++++---- .github/workflows/release-drafter.yml | 66 +++++++++++++++++++++++ .github/workflows/release-github.yml | 36 ------------- .github/workflows/release-plugin-docs.yml | 34 ------------ .github/workflows/release.yml | 15 ++---- .github/workflows/website-deploy.yml | 11 ++-- 7 files changed, 100 insertions(+), 97 deletions(-) create mode 100644 .github/actions/build-api-doc/action.yml create mode 100644 .github/workflows/release-drafter.yml delete mode 100644 .github/workflows/release-github.yml delete mode 100644 .github/workflows/release-plugin-docs.yml diff --git a/.github/actions/build-api-doc/action.yml b/.github/actions/build-api-doc/action.yml new file mode 100644 index 00000000..f86a373f --- /dev/null +++ b/.github/actions/build-api-doc/action.yml @@ -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 diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 60eeb6f8..2d4bd747 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -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 diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..50e43ca9 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -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 }} diff --git a/.github/workflows/release-github.yml b/.github/workflows/release-github.yml deleted file mode 100644 index d4fbc473..00000000 --- a/.github/workflows/release-github.yml +++ /dev/null @@ -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 }} diff --git a/.github/workflows/release-plugin-docs.yml b/.github/workflows/release-plugin-docs.yml deleted file mode 100644 index cbeb2120..00000000 --- a/.github/workflows/release-plugin-docs.yml +++ /dev/null @@ -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}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 013b8db6..1097bbdd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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}} diff --git a/.github/workflows/website-deploy.yml b/.github/workflows/website-deploy.yml index c718d328..9d6c3bd8 100644 --- a/.github/workflows/website-deploy.yml +++ b/.github/workflows/website-deploy.yml @@ -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