Skip to content

Commit

Permalink
chore: Update package release workflow
Browse files Browse the repository at this point in the history
We were using `github.event.release.tag_name` to set the new version of the package, but the tag_name in question contains a leading 'v' (`v4.0.0` for example) which breaks the workflow (invalid semver version, it expects `4.0.0` instead).

Since we are currently bumping the version manually anyway, we can just call yarn publish with the `--non-interactive` flag, which will set the version to the current version defined in package.json (see yarnpkg/yarn#5748).
That's exactly what we want in this context.
  • Loading branch information
MonkeyDo authored Apr 12, 2023
1 parent d71ac26 commit 3cdc737
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/deploy-release-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ jobs:
- name: Install dependencies
run: yarn install --frozen-lockfile

# Make sure you have bumped the version before publishing the release
# This script will not bump the version and will use the version from package.json
# It will just fail if trying to publish an already published version
- name: Build and publish the package
run: yarn publish --new-version ${{ github.event.release.tag_name }}
run: yarn publish --non-interactive
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand All @@ -36,4 +39,4 @@ jobs:
run: |
git add package.json
git commit -m "chore: Release ${{ github.event.release.tag_name }}"
git push origin master
git push origin master

0 comments on commit 3cdc737

Please sign in to comment.