From 465f72ac7c3527cfe23e84d899ee0b4d3e10e347 Mon Sep 17 00:00:00 2001 From: Saransh Chopra Date: Wed, 18 Sep 2024 13:49:12 +0100 Subject: [PATCH] gh-176: revamp publishing workflow (#209) The developers will now be able to download wheels as artifacts from GH Actions without actually publishing a release. This helps in checking if everything is working well or if you want to distribute a pre-release wheel. Anyways, it is a good practice to keep these 2 jobs separate. Closes: #176 Refs: #187 --- .github/workflows/release.yml | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 762a1cc3..7b983dd0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,20 +1,47 @@ name: Release on: + workflow_dispatch: release: types: - published jobs: + dist: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v4 + + - name: Build SDist and wheel + run: pipx run build + + - name: Check metadata + run: pipx run twine check dist/* + + - uses: actions/upload-artifact@v4 + with: + path: dist/* + publish: - name: Publish on PyPI + needs: [dist] runs-on: ubuntu-latest + if: github.event_name == 'release' && github.event.action == 'published' environment: name: publish url: https://pypi.org/p/glass permissions: id-token: write + steps: - - uses: actions/checkout@v4 - - run: pipx run build - - uses: pypa/gh-action-pypi-publish@v1.10.1 + - uses: actions/download-artifact@v4 + with: + name: artifact + path: dist + + - name: List distributions to be deployed + run: ls -l dist/ + + - uses: pypa/gh-action-pypi-publish@release/v1