2022-03-19 19:56:05 +08:00
|
|
|
name: deploy
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
# These tags are protected, see:
|
|
|
|
# https://github.com/pytest-dev/pytest/settings/tag_protection
|
|
|
|
- "[0-9]+.[0-9]+.[0-9]+"
|
|
|
|
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
|
|
|
|
|
|
|
|
|
|
|
|
# Set permissions at the job level.
|
|
|
|
permissions: {}
|
|
|
|
|
|
|
|
jobs:
|
2023-07-03 23:52:58 +08:00
|
|
|
build:
|
2022-03-19 19:56:05 +08:00
|
|
|
runs-on: ubuntu-latest
|
2023-07-03 23:52:58 +08:00
|
|
|
timeout-minutes: 10
|
2022-03-19 19:56:05 +08:00
|
|
|
steps:
|
2022-10-24 20:58:03 +08:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-19 19:56:05 +08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
persist-credentials: false
|
2023-02-13 08:37:40 +08:00
|
|
|
- name: Build and Check Package
|
|
|
|
uses: hynek/build-and-inspect-python-package@v1.5
|
|
|
|
|
2023-07-03 23:52:58 +08:00
|
|
|
deploy:
|
|
|
|
if: github.repository == 'pytest-dev/pytest'
|
|
|
|
needs: [build]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 30
|
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
steps:
|
2023-02-13 08:37:40 +08:00
|
|
|
- name: Download Package
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: Packages
|
|
|
|
path: dist
|
|
|
|
- name: Publish package to PyPI
|
2023-07-17 15:31:06 +08:00
|
|
|
uses: pypa/gh-action-pypi-publish@v1.8.8
|
2023-07-03 23:52:58 +08:00
|
|
|
|
|
|
|
release-notes:
|
2023-02-13 08:37:40 +08:00
|
|
|
|
2023-07-03 23:52:58 +08:00
|
|
|
# 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]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 30
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
persist-credentials: false
|
2022-03-19 19:56:05 +08:00
|
|
|
- name: Set up Python
|
2022-10-24 20:58:03 +08:00
|
|
|
uses: actions/setup-python@v4
|
2022-03-19 19:56:05 +08:00
|
|
|
with:
|
2023-07-01 06:19:19 +08:00
|
|
|
python-version: "3.11"
|
2022-03-19 19:56:05 +08:00
|
|
|
|
2023-07-03 23:52:58 +08:00
|
|
|
|
2023-02-13 08:37:40 +08:00
|
|
|
- name: Install tox
|
2022-03-19 19:56:05 +08:00
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
2023-02-13 08:37:40 +08:00
|
|
|
pip install --upgrade tox
|
2022-03-19 19:56:05 +08:00
|
|
|
|
|
|
|
- name: Publish GitHub release notes
|
|
|
|
env:
|
|
|
|
GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
|
|
|
|
run: |
|
|
|
|
sudo apt-get install pandoc
|
|
|
|
tox -e publish-gh-release-notes
|