From 396b285a27069628b2b171b51547d069cd835dd2 Mon Sep 17 00:00:00 2001 From: object-Object Date: Mon, 28 Aug 2023 02:35:03 -0400 Subject: [PATCH] Fix pypi urls and add PyPI step --- .github/workflows/build_docs.yml | 44 ++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index b32db626..4d0e9bf1 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -6,8 +6,11 @@ on: inputs: publish: description: Whether to publish the docgen to PyPI. - type: boolean - required: true + type: choice + options: + - PyPI + - TestPyPI + required: false segment: description: The version segment to bump with Hatch. type: string @@ -92,18 +95,15 @@ jobs: id: deployment uses: actions/deploy-pages@v2 - publish: + publish-testpypi: runs-on: ubuntu-latest needs: build - if: |- - inputs.publish == true || - startsWith(github.ref, 'refs/tags') || - startsWith(github.event.head_commit.message, '[Release]') + if: inputs.publish == 'TestPyPI' environment: name: testpypi - url: https://pypi.org/p/hexdoc - + url: https://test.pypi.org/p/hexdoc + permissions: id-token: write @@ -116,4 +116,28 @@ jobs: - name: Publish to TestPyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - repository-url: https://test.pypi.org/simple/ + repository-url: https://test.pypi.org/legacy/ + + publish-pypi: + runs-on: ubuntu-latest + needs: build + if: |- + inputs.publish == 'PyPI' || + startsWith(github.ref, 'refs/tags') || + startsWith(github.event.head_commit.message, '[Release]') + + environment: + name: pypi + url: https://pypi.org/p/hexdoc + + permissions: + id-token: write + + steps: + - name: Download hexdoc artifact + uses: actions/download-artifact@v3 + with: + name: hexdoc-build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1