From 0fa5e2aa32188a9481f68e9b36031b5bdc9de53b Mon Sep 17 00:00:00 2001 From: EXPLOSION Date: Sat, 30 Mar 2024 17:21:04 +0900 Subject: [PATCH 1/7] Create release.yml --- .github/workflows/release.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..0731ca1756 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +on: + label: + types: [created] + +jobs: + pypi-publish: + name: upload release to PyPI + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.8" + - run: python -m pip install build + - run: python -m build + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From e806b59feec2fe7a504fd25559f6c48dd5c0a09d Mon Sep 17 00:00:00 2001 From: EXPLOSION Date: Sat, 30 Mar 2024 17:26:13 +0900 Subject: [PATCH 2/7] Update documentation --- docs/source/releasing.rst | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/source/releasing.rst b/docs/source/releasing.rst index 7aec4d7bef..2ed9adf72d 100644 --- a/docs/source/releasing.rst +++ b/docs/source/releasing.rst @@ -41,11 +41,7 @@ Things to do for releasing: * tag with vVERSION, push tag on ``python-trio/trio`` (not on your personal repository) -* push to PyPI:: - - git clean -xdf # maybe run 'git clean -xdn' first to see what it will delete - python3 -m build - twine upload dist/* +* approve the release workflow * update version number in the same pull request From b47fa5f2f8c276427deaa48fb9b4635329df36aa Mon Sep 17 00:00:00 2001 From: EXPLOSION Date: Tue, 2 Apr 2024 17:43:04 +0900 Subject: [PATCH 3/7] Try out a seperate build --- .github/workflows/release.yml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0731ca1756..fd7b11a061 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,13 +2,10 @@ on: label: types: [created] +# a lot of code taken from https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml jobs: - pypi-publish: - name: upload release to PyPI + build: runs-on: ubuntu-latest - environment: release - permissions: - id-token: write steps: - uses: actions/checkout@v4 @@ -18,5 +15,30 @@ jobs: - run: python -m pip install build - run: python -m build + - uses: actions/upload-artifact@v4 + with: + name: trio-sdist + path: dist/*.tar.gz + + - uses: actions/upload-artifact@v4 + with: + name: trio-wheel + path: dist/*.zip + + pypi-publish: + needs: [build] + name: upload release to PyPI + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + + steps: + - uses: actions/download-artifact@v4 + with: + pattern: trio-* + path: dist + merge-multiple: true + - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 From 0bde36e47bf61f333f16ae565489064a94068276 Mon Sep 17 00:00:00 2001 From: EXPLOSION Date: Tue, 2 Apr 2024 17:45:00 +0900 Subject: [PATCH 4/7] Add changelog entry --- newsfragments/2980.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/2980.misc.rst diff --git a/newsfragments/2980.misc.rst b/newsfragments/2980.misc.rst new file mode 100644 index 0000000000..552265ef02 --- /dev/null +++ b/newsfragments/2980.misc.rst @@ -0,0 +1 @@ +Use PyPI's Trusted Publishers to make releases. \ No newline at end of file From 2c1d4b886349a965d6ddee53c6ccd2b040fa3d77 Mon Sep 17 00:00:00 2001 From: EXPLOSION Date: Tue, 2 Apr 2024 17:45:43 +0900 Subject: [PATCH 5/7] Fix formatting --- newsfragments/2980.misc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newsfragments/2980.misc.rst b/newsfragments/2980.misc.rst index 552265ef02..ada9c20e45 100644 --- a/newsfragments/2980.misc.rst +++ b/newsfragments/2980.misc.rst @@ -1 +1 @@ -Use PyPI's Trusted Publishers to make releases. \ No newline at end of file +Use PyPI's Trusted Publishers to make releases. From 2e930cf8d115ac5c612070ff60d1b6381445a292 Mon Sep 17 00:00:00 2001 From: EXPLOSION Date: Tue, 2 Apr 2024 18:30:42 +0900 Subject: [PATCH 6/7] I forgot that wheels aren't .zips --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd7b11a061..8af1e9747c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/upload-artifact@v4 with: name: trio-wheel - path: dist/*.zip + path: dist/*.whl pypi-publish: needs: [build] From 25383d94714c6090e7c6aba8b5253a510c0422cc Mon Sep 17 00:00:00 2001 From: EXPLOSION Date: Thu, 16 May 2024 16:03:05 +0900 Subject: [PATCH 7/7] PR feedback Co-authored-by: webknjaz < webknjaz+github/profile@redhat.com > --- .github/workflows/release.yml | 20 ++++++++++---------- docs/source/releasing.rst | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8af1e9747c..4997b1f675 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ on: - label: - types: [created] + push: + tags: + - v* # a lot of code taken from https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml jobs: @@ -17,19 +18,18 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: trio-sdist - path: dist/*.tar.gz - - - uses: actions/upload-artifact@v4 - with: - name: trio-wheel - path: dist/*.whl + name: trio-dist + path: | + dist/*.tar.gz + dist/*.whl pypi-publish: needs: [build] name: upload release to PyPI runs-on: ubuntu-latest - environment: release + environment: + name: release + url: https://pypi.org/project/trio permissions: id-token: write diff --git a/docs/source/releasing.rst b/docs/source/releasing.rst index 2ed9adf72d..3adc7b17b0 100644 --- a/docs/source/releasing.rst +++ b/docs/source/releasing.rst @@ -41,7 +41,7 @@ Things to do for releasing: * tag with vVERSION, push tag on ``python-trio/trio`` (not on your personal repository) -* approve the release workflow +* approve the release workflow's publish job * update version number in the same pull request