From 0441486dec4c1f06a6b041c67b0e6a6b4631483a Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 10 Mar 2022 20:46:23 +0100 Subject: [PATCH 1/6] Add github action to be able to release on published tag --- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 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 0000000..1bf53bf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Release + +on: + release: + types: + - published + +env: + DEFAULT_PYTHON: 3.9 + +jobs: + release-pypi: + name: Upload release to PyPI + runs-on: ubuntu-latest + steps: + - name: Check out code from Github + uses: actions/checkout@v3.0.0 + - name: Set up Python ${{ env.DEFAULT_PYTHON }} + id: python + uses: actions/setup-python@v3.0.0 + with: + python-version: ${{ env.DEFAULT_PYTHON }} + - name: Install requirements + run: | + python -m pip install -U pip twine wheel + python -m pip install -U "setuptools>=56.0.0" + - name: Build distributions + run: | + python setup.py sdist bdist_wheel + - name: Upload to PyPI + if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags') + env: + TWINE_REPOSITORY: pypi + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + twine upload --verbose dist/* From 342cc1780f60ca030d39d906b7bfc47f396690a6 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 15 Sep 2022 20:36:17 +0200 Subject: [PATCH 2/6] Use the pypi-prod environnement for releasing the package --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1bf53bf..7ece14d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,8 @@ jobs: release-pypi: name: Upload release to PyPI runs-on: ubuntu-latest + environment: + name: pypi-prod steps: - name: Check out code from Github uses: actions/checkout@v3.0.0 From c9cb4beefa0e6febdb2457aaa326010598e048a2 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 2 Jan 2023 12:55:51 +0100 Subject: [PATCH 3/6] Upgrade to use an environnement --- .github/workflows/release.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ece14d..3666624 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,22 +6,27 @@ on: - published env: - DEFAULT_PYTHON: 3.9 + DEFAULT_PYTHON: "3.11" + +permissions: + contents: read jobs: release-pypi: name: Upload release to PyPI runs-on: ubuntu-latest environment: - name: pypi-prod + name: PyPI + url: https://pypi.org/project/pydocstyle/ steps: - name: Check out code from Github - uses: actions/checkout@v3.0.0 + uses: actions/checkout@v3.2.0 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v3.0.0 + uses: actions/setup-python@v4.4.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Install requirements run: | python -m pip install -U pip twine wheel From ea2f74138c14f1225222a5999b5b497940ce441a Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 2 Jan 2023 13:36:30 +0100 Subject: [PATCH 4/6] handle the two environnement --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3666624..7a51a94 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,10 @@ jobs: name: Upload release to PyPI runs-on: ubuntu-latest environment: - name: PyPI + name: pypi-dev + url: https://test.pypi.org/project/pydocstyle/ + environment: + name: pypi-prod url: https://pypi.org/project/pydocstyle/ steps: - name: Check out code from Github From 2093704aac6b252d459753612236f52af074c2ad Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 2 Jan 2023 20:15:32 +0100 Subject: [PATCH 5/6] Remove pypi-dev that made no sense, we should create another workflow --- .github/workflows/release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7a51a94..d579bd4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,9 +15,6 @@ jobs: release-pypi: name: Upload release to PyPI runs-on: ubuntu-latest - environment: - name: pypi-dev - url: https://test.pypi.org/project/pydocstyle/ environment: name: pypi-prod url: https://pypi.org/project/pydocstyle/ From 1307d1f250bb5d691000e1a7371265b7ed989c02 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 2 Jan 2023 20:16:19 +0100 Subject: [PATCH 6/6] Take review comment into account See https://github.com/PyCQA/pydocstyle/pull/582\#discussion_r1060145450 --- .github/workflows/release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d579bd4..61626a6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,11 +29,10 @@ jobs: check-latest: true - name: Install requirements run: | - python -m pip install -U pip twine wheel - python -m pip install -U "setuptools>=56.0.0" + python -m pip install twine build - name: Build distributions run: | - python setup.py sdist bdist_wheel + python -m build - name: Upload to PyPI if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags') env: