From d4e729027a2acdedd6e330e6be8affc51e1d03b9 Mon Sep 17 00:00:00 2001 From: Matthew Lee <{ID} {username}@users.noreply.github.com> Date: Sun, 16 Aug 2026 17:03:05 +1200 Subject: [PATCH] removing template release --- .github/workflows/initial-setup.yml | 1 - .github/workflows/template-release.yml | 85 -------------------------- release.py | 57 +++++------------ 3 files changed, 16 insertions(+), 127 deletions(-) delete mode 100644 .github/workflows/template-release.yml diff --git a/.github/workflows/initial-setup.yml b/.github/workflows/initial-setup.yml index f77176d..a5876ee 100644 --- a/.github/workflows/initial-setup.yml +++ b/.github/workflows/initial-setup.yml @@ -57,7 +57,6 @@ jobs: rm -f initial_setup.py rm -f .github/workflows/initial-setup.yml rm -f .github/workflows/template-ci.yml - rm -f .github/workflows/template-release.yml rm -f .github/workflows/reusable-template-tests.yml rm -f .github/FUNDING.yml rm -rf tests/template diff --git a/.github/workflows/template-release.yml b/.github/workflows/template-release.yml deleted file mode 100644 index 4d5c36c..0000000 --- a/.github/workflows/template-release.yml +++ /dev/null @@ -1,85 +0,0 @@ -# Releases the template itself, not projects made from it. Deleted by setup. -name: template / release - -on: - workflow_dispatch: - inputs: - version: - description: "Version to release (e.g. 1.2.3, no leading v)" - required: true - type: string - -jobs: - - static-analysis: - if: ${{ github.event.repository.is_template }} - uses: ./.github/workflows/reusable-static-analysis.yml - - template-tests: - if: ${{ github.event.repository.is_template }} - uses: ./.github/workflows/reusable-template-tests.yml - - do_release: - needs: [static-analysis, template-tests] - runs-on: ubuntu-latest - concurrency: release - permissions: - contents: write - - steps: - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - # Workflow inputs reach the shell through `env:`, never by `${{ }}` - # expansion inside `run:`. Direct expansion pastes the raw string into the - # script before bash parses it, so an input can close the quote and run - # arbitrary commands with this job's `contents: write` token. - - name: Guard version + tag - env: - VERSION: ${{ inputs.version }} - run: | - if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "::error::version '$VERSION' is not x.y.z" - exit 1 - fi - if git rev-parse -q --verify "refs/tags/v$VERSION" >/dev/null; then - echo "::error::tag v$VERSION already exists" - exit 1 - fi - - - name: Install uv - uses: astral-sh/setup-uv@v7 - - # initial_setup.py resets this to 0.0.0 in generated projects, so the - # template's own version never leaks downstream. - - name: Set version in pyproject.toml - env: - VERSION: ${{ inputs.version }} - run: | - sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml - uv lock # keep uv.lock's root-package version in sync with the bump - - - name: Commit version bump - env: - VERSION: ${{ inputs.version }} - run: | - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - git add pyproject.toml uv.lock - # Skip the commit on a re-run where the bump already landed, so a - # release that failed after pushing can be re-dispatched. - git diff --cached --quiet || git commit -m "chore: release v$VERSION" - git push - - # No zip to upload: GitHub attaches source archives to every release. - - name: Create GitHub release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - VERSION: ${{ inputs.version }} - run: | - gh release create "v$VERSION" \ - --target "$(git rev-parse HEAD)" \ - --title "v$VERSION" \ - --generate-notes \ - --notes "Template source for v$VERSION. Use the green **Use this template** button to start a project, not these archives." diff --git a/release.py b/release.py index feb4198..d4be02f 100644 --- a/release.py +++ b/release.py @@ -13,7 +13,6 @@ python3 release.py --bump major # 1.0.0 python3 release.py --bump patch --dry-run python3 release.py --bump patch --skip-vendor # ship without vendored deps - python3 release.py --bump patch --template # release the template itself """ from __future__ import annotations @@ -30,7 +29,6 @@ REPO_ROOT = Path(__file__).resolve().parent PYPROJECT = REPO_ROOT / "pyproject.toml" WORKFLOW = "ci-release.yml" -TEMPLATE_WORKFLOW = "template-release.yml" REMOTE = "origin" MAIN_BRANCH = "main" @@ -125,8 +123,8 @@ def _preflight() -> None: branch = _capture(["git", "rev-parse", "--abbrev-ref", "HEAD"]) if branch != MAIN_BRANCH: _die( - f"on '{branch}', not '{MAIN_BRANCH}'. The release workflow bumps " - f"and commits to '{MAIN_BRANCH}', so check it out first." + f"on '{branch}', not '{MAIN_BRANCH}'. Releases are cut from " + f"'{MAIN_BRANCH}', so check it out first." ) # Untracked junk (build artifacts, .idea/, etc.) doesn't block the release. @@ -157,7 +155,7 @@ def _confirm(prompt: str, assume_yes: bool) -> None: _die("aborted.") -def _dispatch(version: str, dry_run: bool, skip_vendor: bool, template: bool) -> None: +def _dispatch(version: str, dry_run: bool, skip_vendor: bool) -> None: """Dispatch the release workflow for the given version. Args: @@ -165,26 +163,15 @@ def _dispatch(version: str, dry_run: bool, skip_vendor: bool, template: bool) -> dry_run: If True, print the command instead of running it. skip_vendor: If True, tell the workflow to ship without vendoring runtime dependencies, even if the project has them. - template: If True, dispatch the template's own source release instead - of the Maya module release. Raises: - SystemExit: If the chosen workflow isn't in this repo. Each exists on - only one side: the template release workflow is deleted by setup, - and the project's is still under ``_new_project/`` until then. + SystemExit: If the release workflow is missing from this repo. """ - workflow = TEMPLATE_WORKFLOW if template else WORKFLOW - if not (REPO_ROOT / ".github" / "workflows" / workflow).is_file(): - hint = ( - "--template only works in the template repo." - if template - else "run it in a project generated from the template, or pass --template." - ) - _die(f"{workflow} not found, {hint}") + if not (REPO_ROOT / ".github" / "workflows" / WORKFLOW).is_file(): + _die(f"{WORKFLOW} not found in .github/workflows.") - cmd = ["gh", "workflow", "run", workflow, "-f", f"version={version}"] - # The template ships as source: it has no module to vendor into. - if skip_vendor and not template: + cmd = ["gh", "workflow", "run", WORKFLOW, "-f", f"version={version}"] + if skip_vendor: cmd += ["-f", "vendor_deps=false"] if dry_run: print(f"[dry-run] would dispatch: {' '.join(cmd)}") @@ -220,41 +207,29 @@ def main(argv: list[str]) -> int: help="Ship without vendoring runtime dependencies, even if the " "project has them.", ) - parser.add_argument( - "--template", - action="store_true", - help="Release the template itself (tag + source archive) rather than " - "building a Maya module. Template repo only.", - ) args = parser.parse_args(argv) - if args.template and args.skip_vendor: - _die( - "--skip-vendor is meaningless with --template, the template has no module." - ) - _preflight() - old = _read_version() - new = _bump(old, args.bump) - old_str = ".".join(map(str, old)) - new_str = ".".join(map(str, new)) + current = _read_version() + current_str = ".".join(map(str, current)) + + new_str = ".".join(map(str, _bump(current, args.bump))) _confirm( - f"Dispatch {'template ' if args.template else ''}release " - f"{old_str} -> {new_str} (workflow bumps, tests, tags, and publishes)" + f"Dispatch release {current_str} -> {new_str} " + "(workflow bumps, tests, tags, and publishes)" + (", without vendoring dependencies" if args.skip_vendor else "") + "?", args.yes, ) - _dispatch(new_str, args.dry_run, args.skip_vendor, args.template) + _dispatch(new_str, args.dry_run, args.skip_vendor) if not args.dry_run: - built = "deploy the docs" if args.template else "build the module zip" print( f"\nDispatched release {new_str}. The workflow will run tests, bump " - f"pyproject.toml, tag, {built}, and create the GitHub " + "pyproject.toml, tag, build the module zip, and create the GitHub " "Release. Watch it under the Actions tab." ) return 0