-
Notifications
You must be signed in to change notification settings - Fork 0
Develop #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #27
Changes from all commits
0c6a513
9044f43
64e85c9
df48b91
1356f98
1895f8f
4e6247a
ddc1934
c05316b
b2a9300
66d76b8
6bdfd22
18815b9
95c840b
8efabd5
12dfa56
7ed77ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,19 +20,51 @@ jobs: | |||||
| with: | ||||||
| fetch-depth: 0 | ||||||
|
|
||||||
| - name: Validate tag exists on this push | ||||||
| - name: Validate version tag and package.json | ||||||
| run: | | ||||||
| TAG=$(git describe --exact-match --tags HEAD 2>/dev/null || echo "") | ||||||
| # Try to find a version tag on HEAD or recent commits | ||||||
| TAG=$(git describe --exact-match --tags HEAD 2>/dev/null || git tag --list --sort=-version:refname --merged HEAD 'v*.*.*' | head -1 || echo "") | ||||||
|
|
||||||
| if [[ -z "$TAG" ]]; then | ||||||
| echo "❌ No tag found on HEAD. This push did not include a version tag." | ||||||
| echo "To publish, merge to master with a tag: git tag v1.0.0 && git push origin master --tags" | ||||||
| echo "❌ ERROR: No version tag found!" | ||||||
| echo "" | ||||||
| echo "This typically happens when:" | ||||||
| echo " 1. You forgot to run 'npm version patch|minor|major' on develop" | ||||||
| echo " 2. You didn't push tags when merging develop→master" | ||||||
| echo " 3. PR merge didn't include the tag from develop" | ||||||
| echo "" | ||||||
| echo "📋 Correct workflow:" | ||||||
| echo " 1. On develop: npm version patch (or minor/major)" | ||||||
| echo " 2. On develop: git push origin develop --tags" | ||||||
| echo " 3. Create PR develop→master and merge" | ||||||
| echo " 4. Workflow automatically triggers on master with the tag" | ||||||
|
Comment on lines
+31
to
+40
|
||||||
| echo "" | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| # Validate tag format | ||||||
| if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||||||
| echo "❌ Invalid tag format: $TAG. Expected: v*.*.*" | ||||||
| echo "❌ ERROR: Invalid tag format: '$TAG'" | ||||||
| echo "Expected format: v*.*.* (e.g., v1.0.0, v0.2.3)" | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| # Extract version from tag | ||||||
| TAG_VERSION="${TAG#v}" # Remove 'v' prefix | ||||||
| PKG_VERSION=$(grep '"version"' package.json | head -1 | sed 's/.*"version": "\([^"]*\)".*/\1/') | ||||||
|
||||||
| PKG_VERSION=$(grep '"version"' package.json | head -1 | sed 's/.*"version": "\([^"]*\)".*/\1/') | |
| PKG_VERSION=$(node -p "require('./package.json').version") |
Copilot
AI
Mar 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TAG_VERSION is computed without the v prefix, but the value exported to $GITHUB_ENV is $TAG (still includes the v prefix). This makes the env var name misleading and can break later steps that expect a pure semver (e.g., 0.0.1). Export the actual TAG_VERSION value (or rename the variable to TAG).
| echo "TAG_VERSION=$TAG" >> $GITHUB_ENV | |
| echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@ciscode/notification-kit", | ||
| "version": "0.0.0", | ||
| "version": "0.0.1", | ||
|
||
| "description": "A notification library for NestJS applications.", | ||
| "author": "CisCode", | ||
| "publishConfig": { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow no longer guarantees the HEAD commit is tagged: it falls back to the most recent merged
v*.*.*tag, so a push tomasterwithout a new tag can still pass validation and attempt to publish again (likely failing with “version already exists” or, worse, publishing from an untagged commit). Consider requiring an exact tag onHEADand/or triggering the workflow onpushtotags: ['v*.*.*']so the published commit is always the tagged one.