From 8d417fea3e3a64332aedaa2f6364d7c765967868 Mon Sep 17 00:00:00 2001 From: Marius Helf Date: Mon, 12 Oct 2026 23:36:48 +0200 Subject: [PATCH] chore: remove release and PyPI publish workflows from the template Generated projects are never published to PyPI. Drop the template's release.yaml and publish.yaml, the workflow_call trigger only release.yaml used, the PyPI badge and release instructions in the README, and the test that only covered release.yaml. Co-Authored-By: Claude Opus 5.5 --- template/.github/workflows/ci.yaml | 1 - template/.github/workflows/publish.yaml | 20 ------ template/.github/workflows/release.yaml | 87 ------------------------- template/README.md.jinja | 11 ---- tests/test_template.py | 15 ----- 5 files changed, 134 deletions(-) delete mode 100644 template/.github/workflows/publish.yaml delete mode 100644 template/.github/workflows/release.yaml diff --git a/template/.github/workflows/ci.yaml b/template/.github/workflows/ci.yaml index 5418702..2d3841d 100644 --- a/template/.github/workflows/ci.yaml +++ b/template/.github/workflows/ci.yaml @@ -4,7 +4,6 @@ on: push: branches: [main] pull_request: - workflow_call: # Least privilege: jobs only read the repo. permissions: diff --git a/template/.github/workflows/publish.yaml b/template/.github/workflows/publish.yaml deleted file mode 100644 index 9bbf316..0000000 --- a/template/.github/workflows/publish.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Publish to PyPI - -on: - release: - types: [published] - -jobs: - publish: - environment: production - runs-on: ubuntu-latest - permissions: - id-token: write - contents: read - steps: - - name: Download release artifacts - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TAG: ${{ github.event.release.tag_name }} - run: gh release download "$TAG" --dir dist --repo "$GITHUB_REPOSITORY" - - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 diff --git a/template/.github/workflows/release.yaml b/template/.github/workflows/release.yaml deleted file mode 100644 index 945cb2b..0000000 --- a/template/.github/workflows/release.yaml +++ /dev/null @@ -1,87 +0,0 @@ -name: Release - -on: - workflow_dispatch: - inputs: - force: - description: "Force bump level (leave empty for auto)" - required: false - type: choice - options: - - "" - - patch - - minor - - major - prerelease: - description: "Create a pre-release (e.g., 1.0.0-rc.1)" - required: false - type: boolean - default: false - prerelease_token: - description: "Pre-release identifier (e.g., rc, beta, alpha)" - required: false - type: string - default: "rc" - -# Least privilege: read-only by default; the release job widens its own token. -permissions: - contents: read - -jobs: - ci: - uses: ./.github/workflows/ci.yaml - - release: - needs: ci - runs-on: ubuntu-latest - concurrency: {group: release, cancel-in-progress: false} - permissions: - contents: write - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ github.ref_name }} - fetch-depth: 0 - - - name: Semantic Release (version only) - id: semrel - uses: python-semantic-release/python-semantic-release@39dd2052f2ce8282a5d932c31d58a2ca06d2550e # v10.6.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - force: ${{ github.event.inputs.force }} - prerelease: ${{ github.event.inputs.prerelease }} - prerelease_token: ${{ github.event.inputs.prerelease_token }} - changelog: false - vcs_release: false - - - name: Build package - if: steps.semrel.outputs.released == 'true' - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 - with: {python-version: "3.12"} - - if: steps.semrel.outputs.released == 'true' - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - - if: steps.semrel.outputs.released == 'true' - run: uv build - - - name: Generate release notes - if: steps.semrel.outputs.released == 'true' - run: | - pipx install python-semantic-release - semantic-release changelog - awk '/^## v/{if(found) exit; found=1} found' CHANGELOG.md > release_notes.md - - - name: Create draft GitHub Release with artifacts - if: steps.semrel.outputs.released == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - PRERELEASE_FLAG="" - if [ "${{ steps.semrel.outputs.is_prerelease }}" = "true" ]; then - PRERELEASE_FLAG="--prerelease" - fi - gh release create "${{ steps.semrel.outputs.tag }}" \ - dist/* \ - --draft \ - --notes-file release_notes.md \ - --title "${{ steps.semrel.outputs.tag }}" \ - $PRERELEASE_FLAG diff --git a/template/README.md.jinja b/template/README.md.jinja index 2eaff08..1483119 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -1,7 +1,6 @@ # {{ project_name }} [![Tests](https://github.com/{{ github_username }}/{{ repo_name }}/actions/workflows/ci.yaml/badge.svg)](https://github.com/{{ github_username }}/{{ repo_name }}/actions/workflows/ci.yaml) -[![PyPI version](https://badge.fury.io/py/{{ project_slug | replace('_', '-') }}.svg)](https://pypi.org/project/{{ project_slug | replace('_', '-') }}/) {{ project_short_description }} @@ -76,16 +75,6 @@ skills: `check-docs` audits the docs against the code and emits a report; `update-docs` repairs the gaps. Run `check-docs` periodically (or in CI) and feed its report to `update-docs` to keep the docs current. -## Releasing - -Releases are managed via [python-semantic-release](https://python-semantic-release.readthedocs.io/). -Use [conventional commits](https://www.conventionalcommits.org/) to trigger automatic version bumps. - -To create a release, trigger the "Release" workflow manually from GitHub Actions. -This will create a draft release in GitHub. -When the draft release is published, the package is automatically uploaded to PyPI. - - # Contact {{ author_name }} ([{{ author_email }}](mailto:{{ author_email }})) diff --git a/tests/test_template.py b/tests/test_template.py index 557e96c..c4a542a 100644 --- a/tests/test_template.py +++ b/tests/test_template.py @@ -299,21 +299,6 @@ def test_generated_workflows_pin_actions_to_sha(project): assert_actions_are_sha_pinned(project.path / ".github" / "workflows") -def test_generated_release_keeps_local_workflow_ref_unpinned(project): - """The local reusable-workflow ref must stay a path, not become a SHA. - - ``uses: ./.github/workflows/...`` refers to a file inside the generated repo - itself. A SHA there would pin the project to one of its own commits that does - not exist yet — so this ref is deliberately excluded from the pinning sweep. - """ - local = [ - (path.name, ref) - for path, _, ref, _ in _uses_refs(project.path / ".github" / "workflows") - if ref.startswith("./") - ] - assert local == [("release.yaml", "./.github/workflows/ci.yaml")] - - def test_default_slug_is_valid_package_name(tmp_path): """The auto-derived project_slug must be a valid Python package name.