Skip to content

Commit 36ffd9d

Browse files
authored
feat: verbose make targets, separate bump from release, tag-triggered publish (#17)
- Remove @ prefix from convenience targets (version, bump-*, release) so commands are printed, teaching users the underlying operations - Separate bump from release: make release no longer bumps, run make bump-patch/minor/major first - Change publish workflow trigger from release:published to push:tags:v* - Add release job to auto-create GitHub Release with generated notes - Update RELEASE.md and README.md to reflect new workflow
1 parent 4522a6f commit 36ffd9d

File tree

4 files changed

+56
-48
lines changed

4 files changed

+56
-48
lines changed

.github/workflows/publish.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: Publish to PyPI
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
tags:
6+
- "v*"
67

78
permissions:
8-
contents: read
9+
contents: write
910
id-token: write
1011

1112
jobs:
@@ -50,3 +51,14 @@ jobs:
5051

5152
- name: Publish to PyPI
5253
uses: pypa/gh-action-pypi-publish@release/v1
54+
55+
release:
56+
needs: publish
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v6
60+
61+
- name: Create GitHub Release
62+
run: gh release create "${{ github.ref_name }}" --generate-notes
63+
env:
64+
GH_TOKEN: ${{ github.token }}

Makefile

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,26 @@ clean: ## Remove build artifacts
2929
find . -type f -name '*.pyc' -delete 2>/dev/null || true
3030

3131
version: ## Show current version
32-
@uv run python -c "from importlib.metadata import version; print(version('worktreeflow'))"
32+
uv run python -c "from importlib.metadata import version; print(version('worktreeflow'))"
3333

3434
bump-patch: ## Bump patch version (e.g. 0.3.0 → 0.3.1)
35-
@uv run python scripts/bump_version.py patch
35+
uv run python scripts/bump_version.py patch
3636

3737
bump-minor: ## Bump minor version (e.g. 0.3.0 → 0.4.0)
38-
@uv run python scripts/bump_version.py minor
38+
uv run python scripts/bump_version.py minor
3939

4040
bump-major: ## Bump major version (e.g. 0.3.0 → 1.0.0)
41-
@uv run python scripts/bump_version.py major
42-
43-
release: ## Bump, sync, commit, tag (usage: make release BUMP=patch)
44-
@BUMP=$${BUMP:-patch}; \
45-
$(MAKE) bump-$$BUMP; \
46-
uv sync; \
47-
VERSION=$$(uv run python -c "from importlib.metadata import version; print(version('worktreeflow'))"); \
48-
git add pyproject.toml; \
49-
git commit -m "chore: bump version to $$VERSION"; \
50-
git tag "v$$VERSION"; \
51-
echo ""; \
52-
echo "Created tag v$$VERSION."; \
53-
echo "Run 'git push && git push --tags' to publish."
41+
uv run python scripts/bump_version.py major
42+
43+
release: ## Sync, commit, tag (run make bump-* first)
44+
uv sync
45+
$(eval VERSION := $(shell uv run python -c "from importlib.metadata import version; print(version('worktreeflow'))"))
46+
git add pyproject.toml
47+
git commit -m "chore: bump version to $(VERSION)"
48+
git tag "v$(VERSION)"
49+
@echo ""
50+
@echo "Created tag v$(VERSION)."
51+
@echo "Run 'git push && git push --tags' to publish."
5452

5553
completions-bash: ## Generate bash completions
5654
_WTF_COMPLETE=bash_source uv run wtf

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ make version # Show current version
167167
make bump-patch # Bump patch version (0.3.0 → 0.3.1)
168168
make bump-minor # Bump minor version (0.3.0 → 0.4.0)
169169
make bump-major # Bump major version (0.3.0 → 1.0.0)
170-
make release # Bump, commit, tag (usage: make release BUMP=minor)
170+
make release # Sync, commit, tag (run make bump-* first)
171171
```
172172

173173
### Shell Completions
@@ -196,7 +196,7 @@ Quick reference:
196196
```bash
197197
make version # Show current version
198198
make bump-patch # Bump patch version
199-
make release # Bump, commit, and tag (then push manually)
199+
make release # Commit and tag (run bump-* first, then push)
200200
```
201201

202202
### Dual Functionality

RELEASE.md

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,48 +28,47 @@ After bumping, run `uv sync` to refresh the editable install so `wtf version` re
2828

2929
## Full Release
3030

31-
The `make release` target automates: bump → synccommit tag.
31+
First bump the version, then run `make release` to sync, commit, and tag:
3232

3333
```bash
34-
# Patch release (default)
35-
make release
34+
# 1. Bump version
35+
make bump-patch # or bump-minor / bump-major
3636

37-
# Minor release
38-
make release BUMP=minor
37+
# 2. Commit and tag
38+
make release
3939

40-
# Major release
41-
make release BUMP=major
40+
# 3. Push (triggers CI → PyPI publish → GitHub Release)
41+
git push && git push --tags
4242
```
4343

44-
This will:
45-
1. Bump the version in `pyproject.toml`
46-
2. Run `uv sync` to update the local install
47-
3. Commit the version change
48-
4. Create a git tag (e.g., `v0.4.0`)
44+
`make release` will:
45+
1. Run `uv sync` to update the local install
46+
2. Commit the version change in `pyproject.toml`
47+
3. Create a git tag (e.g., `v0.4.0`)
4948

50-
It does **not** push automatically. Review the commit and tag, then:
49+
It does **not** push automatically — review the commit and tag first.
5150

52-
```bash
53-
git push && git push --tags
54-
```
51+
All make targets print the underlying commands they execute, so you can see exactly what's happening and learn the manual steps.
5552

5653
## Publishing to PyPI
5754

5855
### Automated (Recommended)
5956

60-
Publishing is handled by GitHub Actions. The workflow (`.github/workflows/publish.yml`) triggers when a **GitHub Release** is published:
57+
Publishing is handled by GitHub Actions (`.github/workflows/publish.yml`). Pushing a version tag triggers the full pipeline automatically:
6158

62-
1. Push the version bump and tag (see above)
63-
2. Go to [GitHub Releases](https://github.com/smorinlabs/worktreeflow/releases)
64-
3. Click **Draft a new release**
65-
4. Select the tag you just pushed (e.g., `v0.4.0`)
66-
5. Add release notes
67-
6. Click **Publish release**
59+
```bash
60+
make bump-patch # bump version
61+
make release # sync, commit, tag
62+
git push && git push --tags # triggers CI
63+
```
6864

6965
The CI will automatically:
70-
- Run the test suite
71-
- Build the package with `uv build`
72-
- Publish to PyPI via OIDC (trusted publisher)
66+
1. Run the test suite
67+
2. Build the package with `uv build`
68+
3. Publish to PyPI via OIDC (trusted publisher)
69+
4. Create a GitHub Release with auto-generated notes
70+
71+
No manual GitHub Release creation needed — it's all triggered by the tag push.
7372

7473
### Manual
7574

@@ -90,4 +89,3 @@ uv publish # requires PyPI API token
9089
- [ ] `wtf version` shows correct version
9190
- [ ] Changes committed and tagged (`make release`)
9291
- [ ] Pushed to remote (`git push && git push --tags`)
93-
- [ ] GitHub Release created

0 commit comments

Comments
 (0)