Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish new npm package version if the commit has a tag #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v2

- name: Add git tag
id: gittag
run: echo "gittag=$(git tag --points-at HEAD)" >> $GITHUB_OUTPUT

- uses: actions/setup-node@v3
with:
node-version: "18"
Expand All @@ -23,16 +27,20 @@ jobs:
npm run build-index
npm run build

- run: npm version prerelease --preid=dev --no-git-tag-version
- name: make new version
if: steps.gittag.outputs.gittag
run: npm version from-git --no-git-tag-version

- name: push the new tag to GitHub
if: steps.gittag.outputs.gittag
run: |
git config --global user.name 'Rig Automation'
git config --global user.email 'sinbad-io@users.noreply.github.com'
git add package.json
git commit -am "upgraded version of rig npm package [skip ci]"
git push

- run: npm publish --access=public
- name: set token
if: steps.gittag.outputs.gittag
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}