From 9fdb8c3888e072db38e130e0b112f4c17be017e6 Mon Sep 17 00:00:00 2001 From: Selwyn Date: Wed, 1 Apr 2026 16:09:27 +0200 Subject: [PATCH] Update and improve publish workflow --- .github/workflows/ci.yaml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/publish.yaml | 27 ++++++++++----------------- .github/workflows/test.yaml | 30 ------------------------------ .node-version | 1 + .npmrc | 2 +- package.json | 5 +---- 6 files changed, 45 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/test.yaml create mode 100644 .node-version diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..51e81bf --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,32 @@ +name: Continuous Integration + +on: + pull_request: + +permissions: + contents: read + +jobs: + main: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v6 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version-file: '.node-version' + package-manager-cache: false + + - name: Use dependencies cache + uses: actions/cache@v5 + with: + path: ~/.npm + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: npm- + + - name: Install dependencies + run: npm ci --ignore-scripts --no-audit --no-fund + + - run: npm run test diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 4769db1..835ceaa 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -3,34 +3,27 @@ name: Publish Package on: push: tags: - - 'v**' + - 'v*' + +permissions: + contents: read + id-token: write jobs: publish: runs-on: ubuntu-latest timeout-minutes: 10 - permissions: - id-token: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '18' - registry-url: 'https://registry.npmjs.org' - - - name: Use dependencies cache - uses: actions/cache@v3 + uses: actions/setup-node@v6 with: - path: ~/.npm - key: npm-${{ hashFiles('package-lock.json') }} - restore-keys: npm- + node-version-file: '.node-version' + package-manager-cache: false - name: Install dependencies run: npm ci --ignore-scripts --no-audit --no-fund - name: Publish package - run: npm publish --provenance - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} + run: npm publish --access public diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 9c61945..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: Test - -on: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/setup-node@v3 - with: - node-version: '18' - - uses: actions/checkout@v3 - - env: - cache-name: cache-node-modules - name: 'Cache node modules' - uses: actions/cache@v3 - with: - key: "${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}" - path: ~/.npm - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - name: Install Dependencies - run: npm ci - - name: Test - run: 'npm run test' diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..a682cfb --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +v25 diff --git a/.npmrc b/.npmrc index c42da84..c164741 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -engine-strict = true +min-release-age = 2 diff --git a/package.json b/package.json index a92c53b..ff07fc0 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,6 @@ "homepage": "https://github.com/voorhoede/datocms-plugin-computed-fields", "version": "2.5.1", "description": "This plugin allows to compute and define a field value based on other fields", - "engines": { - "node": ">=18.0.0" - }, "scripts": { "start": "cross-env BROWSER='none' PUBLIC_URL='/' react-scripts start", "build": "cross-env PUBLIC_URL='.' react-scripts build", @@ -76,7 +73,7 @@ ], "repository": { "type": "git", - "url": "https://github.com/voorhoede/datocms-plugin-computed-fields.git" + "url": "git+https://github.com/voorhoede/datocms-plugin-computed-fields.git" }, "author": "Voorhoede ", "license": "ISC",