From 9cff30c56b29d5ac8bd9369b2411d5c202c9c259 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 23 Dec 2025 14:01:36 +0900 Subject: [PATCH] Automate publishing to npm --- .github/workflows/build.yml | 2 ++ .github/workflows/publish.yml | 24 ++++++++++++++++++++++++ package.json | 5 ++++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88c1097..501c62f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,11 @@ name: Build + on: pull_request: branches: [main] push: branches: [main] + jobs: build: name: Lint and tests diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f5a9e5a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,24 @@ +name: Publish + +on: + push: + tags: + - 'v*' + +permissions: + id-token: write + contents: read + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-node@v6 + with: + node-version: lts/* + registry-url: https://registry.npmjs.org + - run: npm ci + - run: npm run lint + - run: npm test + - run: npm publish diff --git a/package.json b/package.json index b1d1282..9d865a1 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,10 @@ "version": "4.0.0", "author": "Domenic Denicola (https://domenic.me/)", "license": "MIT", - "repository": "jsdom/html-encoding-sniffer", + "repository": { + "type": "git", + "url": "git+https://github.com/jsdom/html-encoding-sniffer.git" + }, "main": "lib/html-encoding-sniffer.js", "files": [ "lib/"