chore: prepare 0.2.2 release #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to PyPI | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: pypi-publish | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| name: Test and build distributions | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Check out tagged source | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Install test and build dependencies | |
| run: >- | |
| python -m pip install --upgrade 'pip>=24.3,<26' | |
| 'build>=1.2,<2' 'twine>=6,<7' ".[test]" | |
| - name: Verify tag matches package version | |
| shell: bash | |
| run: | | |
| package_version="$( | |
| python - <<'PY' | |
| try: | |
| import tomllib | |
| except ModuleNotFoundError: | |
| import tomli as tomllib | |
| with open("pyproject.toml", "rb") as stream: | |
| print(tomllib.load(stream)["project"]["version"]) | |
| PY | |
| )" | |
| if [[ "${GITHUB_REF_NAME}" != "v${package_version}" ]]; then | |
| echo "Tag ${GITHUB_REF_NAME} does not match package version ${package_version}" >&2 | |
| exit 1 | |
| fi | |
| - name: Run unit tests | |
| run: python -m pytest -q -p no:cacheprovider | |
| - name: Run Docker integration test | |
| run: PG_STAND_BIN=pg-stand sh tests/integration_tls.sh | |
| - name: Build wheel and source distribution | |
| run: python -m build | |
| - name: Check distribution metadata and README rendering | |
| run: python -m twine check dist/* | |
| - name: Smoke-test the built wheel | |
| shell: bash | |
| run: | | |
| python -m venv "${RUNNER_TEMP}/pg-stand-wheel-smoke" | |
| "${RUNNER_TEMP}/pg-stand-wheel-smoke/bin/python" -m pip install dist/*.whl | |
| mkdir -p "${RUNNER_TEMP}/pg-stand-wheel-project" | |
| cd "${RUNNER_TEMP}" | |
| "${RUNNER_TEMP}/pg-stand-wheel-smoke/bin/pg-stand" --version | |
| "${RUNNER_TEMP}/pg-stand-wheel-smoke/bin/pg-stand" init \ | |
| --directory "${RUNNER_TEMP}/pg-stand-wheel-project" | |
| cd "${RUNNER_TEMP}/pg-stand-wheel-project" | |
| "${RUNNER_TEMP}/pg-stand-wheel-smoke/bin/pg-stand" \ | |
| -c configs/single.yaml validate | |
| "${RUNNER_TEMP}/pg-stand-wheel-smoke/bin/python" -c \ | |
| 'from pg_stand.assets import docker_build_context; assert docker_build_context().is_dir()' | |
| - name: Upload distributions for publishing | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: python-distributions | |
| path: dist/ | |
| if-no-files-found: error | |
| retention-days: 7 | |
| publish: | |
| name: Publish distributions to PyPI | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/pg-stand | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download distributions | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: python-distributions | |
| path: dist/ | |
| - name: Publish distributions with trusted publishing | |
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1 |