From 49f3c34bd73be3dc40a3e0cf9cf087e49de97b2d Mon Sep 17 00:00:00 2001 From: Clinton Date: Sat, 17 Aug 2024 23:11:17 +0300 Subject: [PATCH] Add publish workflow (#1) * Add .github/ to npmignore * Add publish workflow * Update publish.yml --- .github/workflows/publish.yml | 28 ++++++++++++++++++++++++++++ .npmignore | 1 + 2 files changed, 29 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ebf2460 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,28 @@ +name: Publish NPM Package +on: + push: + branches: main +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node: "20.x" + + - name: Bump package version + run: | + git config --global user.email "${{github.actor}}@users.noreply.github.com" + git config --global user.name "${{github.actor}}" + + npm version patch + + - name: Push updated package to NPM + run: git push -f && git push --tags -f + env: + GITHUB_TOKEN: ${{ secrets.PUSH_GITHUB_TOKEN }} + + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.npmignore b/.npmignore index 1a366ad..307ee5a 100644 --- a/.npmignore +++ b/.npmignore @@ -2,3 +2,4 @@ node_modules yarn.lock playground.js tests/ +.github/