Skip to content

Commit d972d81

Browse files
committed
feat: Conditionally publish prerelease NPM packages using extracted tags and set package version to a prerelease.
1 parent e37ad0b commit d972d81

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.github/workflows/publish-trusted.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,17 @@ jobs:
4242
ls -la dist/
4343
4444
# Publish using OIDC authentication (no NPM_TOKEN needed)
45+
# Prereleases are published with extracted tag (e.g., v1.0.0-dev.1 → --tag dev)
4546
- name: Publish to npm
46-
run: npm publish --access public --no-git-checks
47+
run: |
48+
VERSION="${GITHUB_REF#refs/tags/v}"
49+
if [[ "$VERSION" == *"-"* ]]; then
50+
# Extract tag name: 1.0.0-dev.1 → dev, 1.0.0-beta.2 → beta
51+
PRERELEASE="${VERSION#*-}" # dev.1 or beta.2
52+
TAG="${PRERELEASE%%.*}" # dev or beta
53+
echo "Publishing prerelease version $VERSION with --tag $TAG"
54+
npm publish --access public --no-git-checks --tag "$TAG"
55+
else
56+
echo "Publishing stable version $VERSION"
57+
npm publish --access public --no-git-checks
58+
fi

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@muhammedaksam/waha-node",
3-
"version": "2025.12.2",
3+
"version": "2025.12.2-dev.1",
44
"type": "module",
55
"description": "Node.js TypeScript SDK for WAHA (WhatsApp HTTP API) - auto-generated from OpenAPI spec",
66
"main": "dist/index.cjs.js",

0 commit comments

Comments
 (0)