How do we set this up to use the tag version as the publish version? #190
-
Is there additional setup to have this publish with the tag version from github instead of using the number in the package.json file? |
Beta Was this translation helpful? Give feedback.
Answered by
mcous
Apr 15, 2024
Replies: 1 comment
-
This action is designed to help you continuously publish to I have not tested this, but something like this could work to publish with the version from name: Publish Package
on:
push:
tags: v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Install development dependencies
run: npm ci
- name: Write git version to `package.json`
run: npm version --from-git
- name: Build package
run: # whatever your package needs
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jnovak-SM2Dev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This action is designed to help you continuously publish to
npm
in the case where you are manually bumping the version number inpackage.json
. I you push a tag to publish, you should probably usenpm
directly. You don't need this action if you're not CD'ing frommain
.I have not tested this, but something like this could work to publish with the version from
git
: