From caefe770f9b85cfe3c6956e60e5de6d4e68a5d43 Mon Sep 17 00:00:00 2001 From: Dieter Stinglhamber Date: Tue, 19 Dec 2023 15:27:18 +0100 Subject: [PATCH] chore: add GitHub workflow to publish on npm --- .github/workflows/check-types.yml | 2 +- .github/workflows/linting.yml | 2 +- .github/workflows/publish.yml | 24 ++++++++++++++++++++++++ .github/workflows/unit-test.yml | 2 +- .husky/pre-commit | 4 ---- package.json | 5 +++++ 6 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100755 .husky/pre-commit diff --git a/.github/workflows/check-types.yml b/.github/workflows/check-types.yml index d651377..75a8c75 100644 --- a/.github/workflows/check-types.yml +++ b/.github/workflows/check-types.yml @@ -19,7 +19,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: 20.3 + node-version: 20 cache: 'pnpm' - run: pnpm install --frozen-lockfile - run: pnpm check:types diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index bcb6032..76d295a 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -19,7 +19,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: 20.3 + node-version: 20 cache: 'pnpm' - run: pnpm install --frozen-lockfile - run: pnpm lint diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..04b588d --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,24 @@ +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: 'pnpm' + - run: pnpm install --frozen-lockfile + - run: pnpm build + - uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.NPM_PUBLISH_TOKEN }} diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 2c2bf1f..14507c8 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -23,7 +23,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: 20.3 + node-version: 20 cache: 'pnpm' - run: pnpm install --frozen-lockfile - run: pnpm test diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index fab6428..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -pnpm lint-staged diff --git a/package.json b/package.json index 5b86663..6c9bda0 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,11 @@ "prettier --write" ] }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, "author": "Elhebert", "license": "MIT", "dependencies": {