From 171928ef40a0660474b549c247b1862830dc979d Mon Sep 17 00:00:00 2001 From: mdrobny Date: Mon, 29 Dec 2025 12:35:51 +0100 Subject: [PATCH 1/2] build: add `publish` Github Actions workflow - to automate release process of the package to NPM and JSR registries - to use "trusted publishing" mechanism --- .github/workflows/publish.yaml | 37 ++++++++++++++++++++++++++++++++++ package.json | 14 +++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..81dbbd8 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,37 @@ +# Publish to NPM and JSR registries whenever a tag is pushed +name: Release package + +on: + push: + tags: v* + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # The OIDC ID token is used for authentication with NPM and JSR + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-node@v6 + with: + node-version-file: ".node-version" + + - name: Install dependencies + run: npm clean-install + + - name: Test + run: node --run ci + + - name: Build + run: node --run build + + # Using "NPM trusted publishing" to authenticate + - name: Publish package to NPM + run: npm publish + + # Using "JSR publshing from Github Actions" to authenticate + - name: Publish package to JSR + run: npx jsr publish diff --git a/package.json b/package.json index 6cddbba..47136cd 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,10 @@ "type": "git", "url": "git+https://github.com/mdrobny/configate.git" }, + "publishConfig": { + "registry": "https://registry.npmjs.org", + "provenance": true + }, "keywords": [ "config" ], @@ -43,5 +47,15 @@ "@biomejs/biome": "2.3.8", "@types/node": "^22.10.6", "typescript": "^5.7.3" + }, + "devEngines": { + "runtime": { + "name": "node", + "onFail": "error" + }, + "packageManager": { + "name": "npm", + "onFail": "error" + } } } From b83784859d331a1064a46097c389e72d024a6b2b Mon Sep 17 00:00:00 2001 From: mdrobny Date: Mon, 29 Dec 2025 12:56:16 +0100 Subject: [PATCH 2/2] ci: update actions version in `run-tests` workflow --- .github/workflows/run-tests.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index 2eb6b9e..f337245 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -1,3 +1,5 @@ +name: Run tests and build + on: pull_request: types: [opened, synchronize] @@ -7,13 +9,11 @@ jobs: run-tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v6 with: - node-version-file: '.node-version' - cache: npm - cache-dependency-path: package-lock.json + node-version-file: ".node-version" - name: Install dependencies run: npm clean-install