From f77dc523e65a2b34eebf4e5854a0fd648ec75e21 Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Sun, 1 Oct 2023 15:15:32 +0800 Subject: [PATCH] =?UTF-8?q?:construction=5Fworker:=20CI:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20Release=20=E6=9D=83=E9=99=90=E9=94=99=E8=AF=AF=20(#?= =?UTF-8?q?2381)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release-drafter.yml | 43 +++++++++++++++++++-------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 0cd38ca1266a..877363c5a9f7 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -59,6 +59,9 @@ jobs: release: if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest + permissions: + id-token: write + contents: write steps: - name: Generate token id: generate-token @@ -78,39 +81,53 @@ jobs: - name: Build API Doc uses: ./.github/actions/build-api-doc - - run: | - echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + - name: Get Version + id: version + run: | + echo "VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT + echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Check Version + if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION + run: exit 1 - uses: release-drafter/release-drafter@v5 with: - name: Release ${{ env.TAG_NAME }} 🌈 - tag: ${{ env.TAG_NAME }} + name: Release ${{ steps.version.outputs.TAG_NAME }} 🌈 + tag: ${{ steps.version.outputs.TAG_NAME }} publish: true env: GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - - name: Build and Publish Package + - name: Build Package run: | poetry build - gh release upload --clobber ${{ env.TAG_NAME }} dist/*.tar.gz dist/*.whl - env: - GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 + - name: Publish package to GitHub + run: | + gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.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 version ${{ steps.version.outputs.VERSION }} poetry build - gh release upload --clobber ${{ env.TAG_NAME }} dist/*.tar.gz dist/*.whl - env: - GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - name: Publish Doc Package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: packages/nonebot-plugin-docs/ + + - name: Publish Doc Package to GitHub + run: | + cd packages/nonebot-plugin-docs/ + gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}