From d399782df7bc650604b2768e7e79ffbd2ab9deb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstr=C3=B6m?= Date: Fri, 2 Aug 2024 17:01:43 +0100 Subject: [PATCH] feat: deploy with ci/cd Deploy to npm after a release has been published. PR: https://github.com/Topsort/topsort.js/pull/30 --- .github/workflows/publish-to-npm.yml | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/publish-to-npm.yml diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml new file mode 100644 index 0000000..b6acae7 --- /dev/null +++ b/.github/workflows/publish-to-npm.yml @@ -0,0 +1,32 @@ +name: Release + +on: + release: + types: [published] + +jobs: + npm-publish: + name: Publish to NPM + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: oven-sh/setup-bun@v2 + - run: bun install + + - name: Set up Node.js + uses: actions/setup-node@v4 + + - name: Run tests + run: bun test + + - name: Build artifacts + run: node_modules/.bin/tsup + + - name: Publish to npm + id: publish + run: | + npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} + npm publish --access public --no-git-checks