From 2fba7bcd2f64aba431815a709bc8b588e022ec79 Mon Sep 17 00:00:00 2001 From: Carlos Torres Date: Thu, 14 May 2026 13:25:45 +0200 Subject: [PATCH] Set package version from release tag before publishing The previous workflow relied on package.json having the correct version, but these repos don't bump it manually before releases. Co-authored-by: Cursor --- .github/workflows/npm-publish.yml | 1 + README.md | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 8395dba..8fbaab6 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -18,4 +18,5 @@ jobs: registry-url: https://registry.npmjs.org - run: yarn install - run: yarn build + - run: npm version "${GITHUB_REF_NAME#v}" --no-git-tag-version - run: npm publish --provenance --tag ${{ contains(github.ref_name,'beta') && 'beta' || 'latest' }} diff --git a/README.md b/README.md index 7cb6643..bc3a5f1 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,9 @@ NOTICE: this package doesn't clean your build directories in each run, so you'd - Update [CHANGELOG](./CHANGELOG.md) with new features, breaking changes, etc - Check you're in `main` branch and everything is up-to-date. -- Run `yarn publish:` or `yarn publish:canary` for canary versions. -- Run `git push && git push --tags` -- Check all test actions triggered after previous push are ✔️. -- Go to [create a new release](https://github.com/cabify/package-build-javascript/releases/new), select previously pushed tag and write a Title. -- Check the action for publish the npm has finished with success. -- [Check on npm package webpage](https://www.npmjs.com/package/@cabify/package-build), the version has been published successfully under `latest` tag. +- Go to [create a new release](https://github.com/cabify/package-build-javascript/releases/new), create a new tag (e.g. `v0.2.0` or `v0.2.0-beta.0` for pre-releases) and write a Title. +- The publish workflow will automatically set the package version from the tag and publish to npm with provenance. +- [Check on npm package webpage](https://www.npmjs.com/package/@cabify/package-build) that the version has been published successfully. ## Contributors ✨