Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 58 additions & 34 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,52 @@ jobs:
with:
attest-build-provenance-github: 'true'

deploy:
if: github.repository == 'pytest-dev/pytest'
generate-gh-release-notes:
needs: [package]
runs-on: ubuntu-latest
environment: deploy
timeout-minutes: 30
permissions:
id-token: write
contents: write
contents: read
steps:
- uses: actions/checkout@v5
with:
persist-credentials: true
fetch-depth: 0
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install --upgrade tox

- name: Generate release notes
env:
VERSION: ${{ github.event.inputs.version }}
run: |
tox -e generate-gh-release-notes -- "$VERSION" gh-release-notes.md

- name: Upload release notes
uses: actions/upload-artifact@v4
with:
name: release-notes
path: gh-release-notes.md
retention-days: 1

publish-to-pypi:
if: github.repository == 'pytest-dev/pytest'
# Need generate-gh-release-notes only for ordering.
# Don't want to release to PyPI if generating GitHub release notes fails.
needs: [package, generate-gh-release-notes]
runs-on: ubuntu-latest
environment: deploy
timeout-minutes: 30
permissions:
id-token: write
steps:
- name: Download Package
uses: actions/download-artifact@v6
with:
Expand All @@ -60,6 +92,18 @@ jobs:
with:
attestations: true

push-tag:
needs: [publish-to-pypi]
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: true

- name: Push tag
env:
VERSION: ${{ github.event.inputs.version }}
Expand All @@ -69,48 +113,28 @@ jobs:
git tag --annotate --message=v"$VERSION" "$VERSION" ${{ github.sha }}
git push origin "$VERSION"

release-notes:

# todo: generate the content in the build job
# the goal being of using a github action script to push the release data
# after success instead of creating a complete python/tox env
needs: [deploy]
create-github-release:
needs: [push-tag, generate-gh-release-notes]
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false

- name: Download Package
uses: actions/download-artifact@v6
with:
name: Packages
path: dist

- name: Set up Python
uses: actions/setup-python@v6
- name: Download release notes
uses: actions/download-artifact@v6
with:
python-version: "3.11"

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install --upgrade tox

- name: Generate release notes
env:
VERSION: ${{ github.event.inputs.version }}
run: |
sudo apt-get install pandoc
tox -e generate-gh-release-notes -- "$VERSION" scripts/latest-release-notes.md
name: release-notes
path: .

- name: Publish GitHub Release
env:
VERSION: ${{ github.event.inputs.version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create --notes-file scripts/latest-release-notes.md --verify-tag "$VERSION" dist/*
gh release create --notes-file gh-release-notes.md --verify-tag "$VERSION" dist/*
2 changes: 1 addition & 1 deletion .github/workflows/doc-check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
python-version: "3.13"
cache: pip

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
python-version: "3.13"

- name: Install dependencies
run: |
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/update-plugin-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
python-version: "3.13"

- name: requests-cache
uses: actions/cache@v4
Expand All @@ -38,13 +37,13 @@ jobs:
key: plugins-http-cache-${{ github.run_id }} # Can use time based key as well
restore-keys: plugins-http-cache-

- name: Install dependencies
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install packaging requests tabulate[widechars] tqdm requests-cache platformdirs
pip install --upgrade tox

- name: Update Plugin List
run: python scripts/update-plugin-list.py
run: tox -e update-plugin-list

- name: Create Pull Request
id: pr
Expand Down
2 changes: 1 addition & 1 deletion RELEASING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Releasing

Both automatic and manual processes described above follow the same steps from this point onward.

#. After all tests pass and the PR has been approved, trigger the ``deploy`` job
#. After all tests pass and the PR has been approved, trigger the ``deploy`` workflow
in https://github.com/pytest-dev/pytest/actions/workflows/deploy.yml, using the ``release-MAJOR.MINOR.PATCH`` branch
as source.

Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-gh-release-notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def extract_changelog_entries_for(version: str) -> str:

def convert_rst_to_md(text: str) -> str:
result = pypandoc.convert_text(
text, "md", format="rst", extra_args=["--wrap=preserve"]
text, "gfm", format="rst", extra_args=["--wrap=preserve"]
)
assert isinstance(result, str), repr(result)
return result
Expand Down
14 changes: 13 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,17 @@ commands = python scripts/prepare-release-pr.py {posargs}
description = generate release notes that can be published as GitHub Release
usedevelop = True
deps =
pypandoc
pypandoc_binary
commands = python scripts/generate-gh-release-notes.py {posargs}

[testenv:update-plugin-list]
description = update the plugin list
skip_install = True
deps =
packaging
requests
tabulate[widechars]
tqdm
requests-cache
platformdirs
commands = python scripts/update-plugin-list.py {posargs}