Skip to content
Merged
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
56 changes: 56 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "Publish Python distribution to PyPI"
# Uses:
# https://github.com/actions/setup-python : 0b93645e9fea7318ecaed2b359559ac225c90a2b
# https://github.com/actions/checkout : 11bd71901bbe5b1630ceea73d27597364c9af683
# https://github.com/actions/download-artifact : fa0a91b85d4f404e444e00e005971372dc801d1c6
# https://github.com/actions/upload-artifact : 6f51ac03b9356f520e9adb1b1b7802705f340c2b
# https://github.com/actions/pypa/gh-action-pypi-publish : 76f52bc884231f62b9a034ebfe128415bbaabdfc

on:
release:
types: [published]

jobs:
build:
name: "Build distribution"
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
persist-credentials: false

- name: "Set up Python"
uses: "actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b"
with:
python-version: "3.12"

- name: "Build the package"
run: "python -m pip install nox; nox --session build"

- name: "Store the distribution packages"
uses: "actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b"
with:
name: "python-package-distributions"
path: "dist/"

publish-to-pypi:
name: "Publish Python Distribution to PyPI"
if: startsWith(github.ref, 'refs/tags/')
needs: ["build"]
runs-on: "ubuntu-latest"
environment:
name: "pypi"
url: "https://pypi.org/p/commented-configparser"
permissions:
id-token: "write"

steps:
- name: "Download all the dists"
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d1c6"
with:
name: "python-package-distributions"
path: "dist/"

- name: "Publish distribution to PyPI"
uses: "pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc"