Publish new npm package version if the commit has a tag #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and push APIs | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
jobs: | |
setup-build-publish-deploy: | |
name: Publish Typescript packages to NPM | |
runs-on: ubuntu-latest | |
steps: | |
- 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" | |
registry-url: "https://registry.npmjs.org" | |
- run: | | |
npm install | |
npm run build-index | |
npm run build | |
- 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 | |
- name: set token | |
if: steps.gittag.outputs.gittag | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |