From ecb1657e54a96fcefed491c08b4431fe5791f475 Mon Sep 17 00:00:00 2001 From: Erik Rose Date: Thu, 28 May 2026 11:55:31 -0400 Subject: [PATCH 1/3] Add a PyPI-publishing job. --- .github/workflows/publish.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a5dfa72 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +# This needs to be merged into a single workflow, called publish.yml, with the +# wheel-building stuff, so it can share artifacts. I'm assuming the +# wheel-building stuff lives in a job called "make-dists". If not, change the +# below reference. + +name: Publish to PyPI + +on: [push] + +jobs: + publish: + name: Publish any pushed version tag to PyPI + # Publish to PyPI only on pushes of tags like "v1.2.3". + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + needs: + - make-dists + runs-on: ubuntu-24.04 + environment: + name: pypi + url: https://pypi.org/p/fastly-compute + permissions: + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # @v6 + with: + name: python-package-distributions + path: dist/ + - name: Publish dists to PyPI + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # @release/v1 From 58b5e393733bee4dae6481fea69b904a501df2ec Mon Sep 17 00:00:00 2001 From: Erik Rose Date: Fri, 29 May 2026 14:33:27 -0400 Subject: [PATCH 2/3] Change the publish workflow to trigger when a GH release is promoted from prerelease MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …and to pull release files from the GH release rather than a build artifact. --- .github/workflows/publish.yml | 34 +++++++++++++++++++--------------- .github/workflows/release.yml | 2 ++ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a5dfa72..4e9b5e3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,30 +1,34 @@ -# This needs to be merged into a single workflow, called publish.yml, with the -# wheel-building stuff, so it can share artifacts. I'm assuming the -# wheel-building stuff lives in a job called "make-dists". If not, change the -# below reference. +# When you promote a GitHub prerelease to an actual release, publish its +# artifacts to PyPI. name: Publish to PyPI -on: [push] +on: + release: + types: [released] jobs: publish: - name: Publish any pushed version tag to PyPI - # Publish to PyPI only on pushes of tags like "v1.2.3". - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') - needs: - - make-dists + name: Publish promoted release to PyPI runs-on: ubuntu-24.04 environment: name: pypi url: https://pypi.org/p/fastly-compute permissions: id-token: write + contents: read steps: - - name: Download all the dists - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # @v6 - with: - name: python-package-distributions - path: dist/ + - name: Download release assets + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + REPO: ${{ github.repository }} + run: | + mkdir dist + gh release download "$TAG_NAME" \ + --repo "$REPO" \ + --dir dist/ \ + --pattern '*.whl' \ + --pattern '*.tar.gz' - name: Publish dists to PyPI uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # @release/v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3bcd404..671f38e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,5 @@ +# Package up release artifacts, and attach them to a new GitHub prerelease. + name: Release # Triggers: From 77bc62929f226e9ea657cc16da88690ed7971827 Mon Sep 17 00:00:00 2001 From: Erik Rose Date: Fri, 29 May 2026 14:41:01 -0400 Subject: [PATCH 3/3] =?UTF-8?q?TAG=5FNAME=20=E2=86=92=20TAG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4e9b5e3..f9d3928 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,7 +25,7 @@ jobs: REPO: ${{ github.repository }} run: | mkdir dist - gh release download "$TAG_NAME" \ + gh release download "$TAG" \ --repo "$REPO" \ --dir dist/ \ --pattern '*.whl' \