chore: enhance npm publish workflow to include version tagging

- Updated the npm publish workflow to dynamically determine the package version and apply a beta tag for pre-release versions.
- This change ensures that the correct versioning is maintained during the publishing process, improving clarity for users regarding package stability.
- Retained existing dry run functionality for testing without actual publishing.
This commit is contained in:
Javier Cortejoso
2026-02-11 18:28:06 +01:00
parent 0091d90263
commit 988c5c2c1a

View File

@@ -98,7 +98,9 @@ jobs:
id: publish
run: |
DRY_RUN="${{ github.event.inputs.dry_run == 'true' && '--dry-run' || '' }}"
npx npm@latest publish --access public $DRY_RUN
VERSION=$(node -p "require('./package.json').version")
TAG=$([[ "$VERSION" == *-* ]] && echo "--tag beta" || echo "")
npx npm@latest publish --access public $TAG $DRY_RUN
- name: Publish result
if: always()
@@ -136,7 +138,9 @@ jobs:
id: publish
run: |
DRY_RUN="${{ github.event.inputs.dry_run == 'true' && '--dry-run' || '' }}"
npx npm@latest publish --access public $DRY_RUN
VERSION=$(node -p "require('./package.json').version")
TAG=$([[ "$VERSION" == *-* ]] && echo "--tag beta" || echo "")
npx npm@latest publish --access public $TAG $DRY_RUN
- name: Publish result
if: always()
@@ -172,7 +176,9 @@ jobs:
id: publish
run: |
DRY_RUN="${{ github.event.inputs.dry_run == 'true' && '--dry-run' || '' }}"
npx npm@latest publish --access public $DRY_RUN
VERSION=$(node -p "require('./package.json').version")
TAG=$([[ "$VERSION" == *-* ]] && echo "--tag beta" || echo "")
npx npm@latest publish --access public $TAG $DRY_RUN
- name: Publish result
if: always()
@@ -205,7 +211,9 @@ jobs:
id: publish
run: |
DRY_RUN="${{ github.event.inputs.dry_run == 'true' && '--dry-run' || '' }}"
npx npm@latest publish --access public $DRY_RUN
VERSION=$(node -p "require('./package.json').version")
TAG=$([[ "$VERSION" == *-* ]] && echo "--tag beta" || echo "")
npx npm@latest publish --access public $TAG $DRY_RUN
- name: Publish result
if: always()
@@ -241,7 +249,9 @@ jobs:
id: publish
run: |
DRY_RUN="${{ github.event.inputs.dry_run == 'true' && '--dry-run' || '' }}"
npx npm@latest publish --access public $DRY_RUN
VERSION=$(node -p "require('./package.json').version")
TAG=$([[ "$VERSION" == *-* ]] && echo "--tag beta" || echo "")
npx npm@latest publish --access public $TAG $DRY_RUN
- name: Publish result
if: always()