diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index d1a5b34..dd97b30 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,34 +1,40 @@ -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created -# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages - -name: Node.js Package +name: Deploy Package to NPM on: push: - branches: - - main + tags: + - "v[0-9]+.[0-9]+.[0-9]+" jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: npm ci - - run: npm run build + publish_npm: + name: Publishing to NPM - publish-npm: - needs: build runs-on: ubuntu-latest + + permissions: + actions: write + contents: write + steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@v3 + + - name: Setup NodeJs + uses: actions/setup-node@v3 with: node-version: 20 registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npm publish + + - name: Install Packages + run: npm ci + + - name: Bump Version of package.json + uses: ramonpaolo/bump-version@v2.3.1 + with: + tag: ${{ github.ref_name }} # Accessing the context and get the reference_name, that in this case, is the tag that you created(ex: v1.0.0) + commit: true + branch_to_push: "main" + + - name: Publish package to NPM + run: npm publish env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # NPM Token necessary to deploy packages on pipelines CI/CD