Skip to content

Instantly share code, notes, and snippets.

@prokopsimek
Created April 26, 2023 07:58
Show Gist options
  • Save prokopsimek/95617ab7ad720d5b1dc7bfd864ad1ec5 to your computer and use it in GitHub Desktop.
Save prokopsimek/95617ab7ad720d5b1dc7bfd864ad1ec5 to your computer and use it in GitHub Desktop.
Automating SDK releases on Github Action
# This workflow will publish a package to npmjs.com when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Node.js Package
on: push
jobs:
publish-npm:
if: "github.ref == 'refs/heads/main' && github.event_name == 'push' && contains(github.event.head_commit.message, 'chore(release)')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Build SDK # for custom build or when using TypeScript
run: npm run build
- name: Publish to NPM
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment