Skip to content

Commit dac4d01

Browse files
chore(release): derive the tag from the version the way tags are published
The script emitted `v${VERSION}`, so a 1.3.0 release printed `v1.3.0` while every published tag is v1.0, v1.1, v1.2. CONTRIBUTING.md repeated the same `v1.1.0` form, so the script and the docs agreed with each other and disagreed with the repository. The tag now drops a `.0` patch and keeps anything else: 1.3.0 → v1.3 (matching v1.0/v1.1/v1.2 exactly), 1.2.1 → v1.2.1 so a fix release stays distinct from the minor it patches, and a pre-release suffix is never stripped. Also corrects the header comment: the script prints the release steps, it does not create the tag itself.
1 parent 1292181 commit dac4d01

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ composer release 1.1.0 # bumps the VERSION constant (see bin/release.sh)
8282
```
8383

8484
Then follow the steps the script prints: move the `[Unreleased]` CHANGELOG entries
85-
under the new version heading, commit, and push a **SemVer tag** (`git tag -s v1.1.0`).
85+
under the new version heading, commit, and push a **signed tag** (`git tag -s v1.1`).
86+
The version constant is full SemVer, while the tag drops a `.0` patch — the script
87+
prints the exact tag to use.
8688
Packagist picks up the tag and publishes it. Verify with:
8789

8890
```bash

‎bin/release.sh‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
#!/usr/bin/env bash
22
# Usage: bash bin/release.sh 1.2.0
3-
# Bumps the version constant and creates a signed git tag.
3+
# Bumps the version constant and prints the remaining release steps. It does not
4+
# commit, tag, or push — those stay in your hands.
45
set -euo pipefail
56

67
VERSION="${1:?Usage: $0 <version> e.g. 1.2.0}"
7-
TAG="v${VERSION}"
88
FILE="src/Version.php"
99

10+
# The version constant is always full SemVer; the tag drops a `.0` patch to
11+
# match the published tags (1.3.0 → v1.3). A non-zero patch keeps it, so a
12+
# fix release stays distinct from the minor it patches (1.2.1 → v1.2.1), and a
13+
# pre-release suffix is never stripped (1.3.0-rc.1 → v1.3.0-rc.1).
14+
TAG="v${VERSION%.0}"
15+
1016
# Validate SemVer shape (no leading v)
1117
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
1218
echo "Error: version must be SemVer without leading 'v' (e.g. 1.2.0 or 1.2.0-rc.1)"

0 commit comments

Comments
 (0)