From c0a462fcea77b0fefd6fc2a7c6aac9f2593a0509 Mon Sep 17 00:00:00 2001 From: Saransh Chopra Date: Fri, 13 Sep 2024 10:38:37 +0100 Subject: [PATCH] gh-176: revamp publishing workflow --- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 762a1cc3..7f9328c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,20 +1,49 @@ 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 + with: + fetch-depth: 0 + + - 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