From 854ec22777edba7dac330397aefdf7bb4b056d49 Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Tue, 21 Jul 2026 06:46:28 -0500 Subject: [PATCH] Add a publishing workflow --- .github/workflows/publish.yaml | 68 ++++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 4 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..08428d5 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,68 @@ +name: '📦 Publish' + +on: + push: + branches: + - 'releases' + +permissions: {} + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +env: + PACKAGES_PATH: 'dist' + +jobs: + build: + outputs: + artifact-id: "${{ steps.upload-packages.outputs.artifact-id }}" + + name: 'Build' + runs-on: 'ubuntu-24.04' + steps: + - name: 'Checkout' + uses: 'actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0' # v7.0.0 + with: + persist-credentials: 'false' + + - name: 'Setup Python' + uses: 'actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1' # v6.3.0 + with: + python-version: '3.14' + + - name: 'Build' + run: | + python -m venv .venv + source .venv/bin/activate + python -m pip install build + python -m build --outdir dist/ + + - name: 'Upload packages' + id: 'upload-packages' + uses: 'actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a' # v7.0.1 + with: + path: "${{ env.PACKAGES_PATH }}" + + + publish: + needs: + - 'build' + environment: 'PyPI' + permissions: + id-token: 'write' # Necessary for uploading to PyPI. + + name: 'Publish' + runs-on: 'ubuntu-24.04' + steps: + - name: 'Download the built packages' + uses: 'actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c' # v8.0.1 + with: + artifact-ids: "${{ needs.build.outputs.artifact-id }}" + path: "${{ env.PACKAGES_PATH }}" + + - name: 'Publish package distributions to PyPI' + uses: 'pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b' # v1.14.0 + with: + packages-dir: "${{ env.PACKAGES_PATH }}" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1864771..8ac0382 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -80,4 +80,6 @@ repos: - repo: "https://github.com/zizmorcore/zizmor-pre-commit" rev: "e3eebf65325ccc992422292cb7a4baee967cf815" # frozen: v1.26.1 hooks: - - id: "zizmor" + - id: "zizmor" + args: + - "--persona=pedantic"