Skip to content
Merged
Show file tree
Hide file tree
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
61 changes: 61 additions & 0 deletions .github/workflows/release-preparation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# SPDX-FileCopyrightText: Copyright (c) 2026, Jared W. Cook
# SPDX-License-Identifier: AGPL-3.0-or-later
---
name: Release Preparation
on:
push:
branches: ["main"]
workflow_dispatch:
inputs:
baseline:
description: "Verified published baseline commit (optional)"
type: string
required: false
published_version:
description: "Verified published version (required with baseline)"
type: string
required: false

permissions:
contents: read

concurrency:
group: release-preparation-${{ github.sha }}
cancel-in-progress: false

jobs:
prepare:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 10
env:
RELEASE_BASELINE: ${{ inputs.baseline }}
PUBLISHED_VERSION: ${{ inputs.published_version }}
steps:
- name: Checkout exact production commit
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.11"
- name: Set artifact directory
run: echo "RELEASE_OUTPUT=$RUNNER_TEMP/release-artifacts" >> "$GITHUB_ENV"
- name: Verify snapshot and package source
run: make package-source
- name: Calculate release plan
if: env.RELEASE_BASELINE != '' || env.PUBLISHED_VERSION != ''
run: make release-plan > "$RELEASE_OUTPUT/plan.json"
- name: Verify source checksum
working-directory: ${{ env.RELEASE_OUTPUT }}
run: |
sha256sum -c SHA256SUMS
sha256sum release.json
- name: Preserve production candidate
uses: actions/upload-artifact@v4
with:
name: release-candidate-${{ github.sha }}
path: ${{ env.RELEASE_OUTPUT }}
if-no-files-found: error
73 changes: 42 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ deps-check: deptry-check ## Run all Dependencies check tasks.
nutrimatic-readme: ## Automated documentation assistant for Jinja and Jekyll templates.
$(AT)echo "Running ☕ Nutri-Matic readme generator..."
$(AT)$(NUTRIMATIC) build readme $(JEKYLL_DIR) $(README_FILE) --tmp-dir $(README_GEN_DIR) --jekyll-cmd 'bundle exec jekyll build --quiet'
$(AT)sed -i 's|^ Edit .*/docs/jekyll/README[.]md instead[.]| Edit docs/jekyll/README.md instead.|' "$(README_FILE)"
$(AT)echo "✅ Nutri-Matic documentation generation complete!"

jekyll-build: ## A Ruby-based static site generator for project documentation.
Expand Down Expand Up @@ -416,15 +417,13 @@ pip-install: ## The standard package installer for Python.
# --------------------------------------------------
# 🚀 Release (git-push, github-release)
# --------------------------------------------------
git-push: ## Distributed version control system for tracking changes in source code.
$(AT)echo "Running 🚀 Pushing tag $(RELEASE) to origin..."
$(AT)$(GIT) push origin $(RELEASE)
$(AT)echo "✅ Push complete!"
git-push:
$(AT)echo "Use reviewed release preparation; direct release mutations are disabled."
$(AT)false

github-release: ## GitHub’s official command line tool for repository and release management.
$(AT)echo "Running 🚀 Creating GitHub release for $(RELEASE)..."
$(AT)$(GITHUB) release create $(RELEASE) --generate-notes
$(AT)echo "✅ GitHub release created!"
github-release:
$(AT)echo "Use reviewed release preparation; direct release mutations are disabled."
$(AT)false
# --------------------------------------------------
# 🛠️ Setup (venv-create, git-init, git-remote, github-auth)
# --------------------------------------------------
Expand Down Expand Up @@ -527,25 +526,21 @@ git-commit: ## Distributed version control system for tracking changes in source
# --------------------------------------------------
# 🔖 Versioning (bumpversion-patch, bumpversion-minor, bumpversion-major, git-tag)
# --------------------------------------------------
bumpversion-patch: ## Version bumping tool with Git tagging support.
$(AT)echo "Running 🔖 Updating $(PROJECT_NAME) patch version from $(VERSION)..."
$(AT)$(BUMPVERSION) bump --verbose patch
$(AT)echo "✅ Patch version update complete!"
bumpversion-patch:
$(AT)echo "Use reviewed release preparation; direct release mutations are disabled."
$(AT)false

bumpversion-minor: ## Version bumping tool with Git tagging support.
$(AT)echo "Running 🔖 Updating $(PROJECT_NAME) minor version from $(VERSION)..."
$(AT)$(BUMPVERSION) bump --verbose minor
$(AT)echo "✅ Minor version update complete!"
bumpversion-minor:
$(AT)echo "Use reviewed release preparation; direct release mutations are disabled."
$(AT)false

bumpversion-major: ## Version bumping tool with Git tagging support.
$(AT)echo "Running 🔖 Updating $(PROJECT_NAME) major version from $(VERSION)..."
$(AT)$(BUMPVERSION) bump --verbose major
$(AT)echo "✅ Major version update complete!"
bumpversion-major:
$(AT)echo "Use reviewed release preparation; direct release mutations are disabled."
$(AT)false

git-tag: ## Distributed version control system for tracking changes in source code.
$(AT)echo "Running 🔖 Creating Git tag for $(RELEASE)..."
$(AT)$(GIT) tag -a $(RELEASE) -m 'Release $(RELEASE)'
$(AT)echo "✅ Git tag created!"
git-tag:
$(AT)echo "Use reviewed release preparation; direct release mutations are disabled."
$(AT)false

# --------------------------------------------------
# Compatibility targets (existing CI, hooks and project commands)
Expand Down Expand Up @@ -592,18 +587,34 @@ test: test-run
.PHONY: readme
readme: nutrimatic-readme
.PHONY: bump-version-patch
bump-version-patch: bumpversion-patch
bump-version-patch:
$(AT)echo "Use reviewed release preparation; direct release mutations are disabled."
$(AT)false
.PHONY: changelog
changelog: git-cliff-full git-cliff-unreleased
$(AT)$(GIT) add "$(CHANGELOG_FILE)" "$(CHANGELOG_RELEASE_FILE)"
.PHONY: git-release release
git-release:
$(AT)$(MAKE) git-tag
$(AT)$(MAKE) git-push
$(AT)$(MAKE) github-release
release:
$(AT)$(MAKE) git-release
$(AT)$(MAKE) bump-version-patch
$(AT)echo "Use reviewed release preparation; direct release mutations are disabled."
$(AT)false
# Version planning is read-only. Publishing is separately authorized.
.PHONY: release-plan package-source release-prepare
release-plan:
$(AT)python3 scripts/release_plan.py --baseline "$$RELEASE_BASELINE" \
--published-version "$$PUBLISHED_VERSION" --current-version "$(VERSION)"

release-prepare:
$(AT)test -n "$$RELEASE_OUTPUT"
$(AT)$(PYTHON) scripts/release_prepare.py --baseline "$$RELEASE_BASELINE" \
--published-version "$$PUBLISHED_VERSION" --current-version "$(VERSION)" \
--output "$$RELEASE_OUTPUT"

package-source:
$(AT)test -n "$$RELEASE_OUTPUT"
$(AT)python3 scripts/release_plan.py --current-version "$(VERSION)" \
--package-dir "$$RELEASE_OUTPUT"

release: release-plan
# Keep setup and checks sequential even when make is invoked with -j.
all: python-install
$(AT)$(MAKE) lint-check
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
Auto-generated file. Do not edit directly.
Edit /home/jcook/Documents/git_repo/cookscodeinc/python3-cookiecutter/docs/jekyll/README.md instead.
Edit docs/jekyll/README.md instead.
Run ```make readme``` to regenerate this file
-->
<h1 id="python3-cookiecutter">python3-cookiecutter</h1>
Expand Down Expand Up @@ -174,3 +174,11 @@ make release-plan
was generated. Direct publication, upload, tagging and version-bump commands
are disabled in generated projects. Publication requires separate
configuration and approval. The current build dependencies are not locked.</p>

<h2 id="generator-source-release-preparation">Generator source release preparation</h2>

<p>The generator itself has a separate read-only source package workflow.
Use <code class="language-plaintext highlighter-rouge">make release-plan</code>, <code class="language-plaintext highlighter-rouge">make release-prepare</code> and <code class="language-plaintext highlighter-rouge">make package-source</code>
at the generator root. See <code class="language-plaintext highlighter-rouge">docs/release-cycle.md</code> in the generator
repository for the exact baseline, output directory and checksum checks.
This does not publish packages or modify a generated project’s version.</p>
5 changes: 5 additions & 0 deletions changelogs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
- Migrate repository configuration to cookscodeinc
- Import shared spelling dictionary
- Add containerized documentation preview
- Generate reviewed Python release preparation
- Prepare reviewed Python generator releases

### 🐛 Fixed

Expand Down Expand Up @@ -173,3 +175,6 @@ fix: update shared spelling dictionary
- Merge pull request #27 from cookscodeinc/feat-011

fix: update shared spelling dictionary
- Merge pull request #29 from cookscodeinc/feat-012

feat: generate reviewed Python release preparation
7 changes: 6 additions & 1 deletion changelogs/releases/v0.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Changelog:
# --------------------------------------------------

## [0.1.0] - 2026-12-01
## [0.1.0] - 2026-12-02

### 🚀 Added

Expand All @@ -11,6 +11,8 @@
- Migrate repository configuration to cookscodeinc
- Import shared spelling dictionary
- Add containerized documentation preview
- Generate reviewed Python release preparation
- Prepare reviewed Python generator releases

### 🐛 Fixed

Expand Down Expand Up @@ -173,3 +175,6 @@ fix: update shared spelling dictionary
- Merge pull request #27 from cookscodeinc/feat-011

fix: update shared spelling dictionary
- Merge pull request #29 from cookscodeinc/feat-012

feat: generate reviewed Python release preparation
9 changes: 9 additions & 0 deletions docs/jekyll/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,12 @@ The version selectors cover package metadata and the documentation that
was generated. Direct publication, upload, tagging and version-bump commands
are disabled in generated projects. Publication requires separate
configuration and approval. The current build dependencies are not locked.


## Generator source release preparation

The generator itself has a separate read-only source package workflow.
Use `make release-plan`, `make release-prepare` and `make package-source`
at the generator root. See `docs/release-cycle.md` in the generator
repository for the exact baseline, output directory and checksum checks.
This does not publish packages or modify a generated project's version.
23 changes: 23 additions & 0 deletions docs/release-cycle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generator release preparation

The Python generator's own release is separate from releases of the
projects it generates. Its source candidate is a ZIP archive of the
generator, not an installable project package.

On a clean numbered feature branch, provide the exact full commit of
a verified published baseline and the corresponding published version.
Set `RELEASE_BASELINE` and `PUBLISHED_VERSION`, then run
`make release-plan`. Run `make release-prepare` with `RELEASE_OUTPUT`
pointing to a new directory outside the checkout to export a proposed
version patch. The helper verifies all supported version fields without
applying changes, committing, tagging or publishing.

Run `make package-source` with a new `RELEASE_OUTPUT` directory to
prepare the exact committed source archive. Verify `SHA256SUMS` and
retain the complete `release.json` manifest. The main-branch Release
Preparation workflow preserves this candidate with read-only repository
permissions. No GitHub Release or package registry publication is enabled.

Legacy direct release targets at the generator root fail closed.
Generated projects retain their existing package workflows and manual
lifecycle commands. Their versions and publication approvals are separate.
18 changes: 16 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,25 @@ tag = false
commit = false

[[tool.bumpversion.files]]
filename = "Makefile"
filename = "pyproject.toml"
search = "\nversion = \"{current_version}\""
replace = "\nversion = \"{new_version}\""
[[tool.bumpversion.files]]
filename = "README.md"
filename = "Makefile"
search = "VERSION := {current_version}"
replace = "VERSION := {new_version}"
[[tool.bumpversion.files]]
filename = "docs/cookiecutter_input.json"
search = '"version": "{current_version}"'
replace = '"version": "{new_version}"'
[[tool.bumpversion.files]]
filename = "docs/jekyll/Makefile"
search = 'VERSION = "{current_version}"'
replace = 'VERSION = "{new_version}"'
[[tool.bumpversion.files]]
filename = "docs/jekyll/_config.yml"
search = 'version: "{current_version}"'
replace = 'version: "{new_version}"'
# ====================================
# Codespell Configuration:
# ====================================
Expand Down
25 changes: 25 additions & 0 deletions release-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"candidate_adapter": {
"kind": "source"
},
"required_pr_checks": [
"tests",
"jinja2-lint",
"typecheck",
"black-format-check",
"dependency-check",
"security-audit",
"spellcheck",
"CLAAssistant"
],
"required_push_workflows": [
".github/workflows/dependency-check.yml",
".github/workflows/format-check.yml",
".github/workflows/lint-check.yml",
".github/workflows/security-audit.yml",
".github/workflows/spellcheck.yml",
".github/workflows/tests.yml",
".github/workflows/typecheck.yml",
".github/workflows/release-preparation.yml"
]
}
Loading
Loading