diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..508d654 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,35 @@ +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 + registry-url: 'https://registry.npmjs.org' + + - 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 lint + + - run: npm run test diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 4769db1..6bec127 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -3,7 +3,7 @@ name: Publish Package on: push: tags: - - 'v**' + - 'v*' jobs: publish: @@ -11,26 +11,18 @@ jobs: timeout-minutes: 10 permissions: id-token: write + contents: read steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v6 with: - node-version: '18' - registry-url: 'https://registry.npmjs.org' - - - name: Use dependencies cache - uses: actions/cache@v3 - 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 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 64bb4cb..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: Test - -on: pull_request - -jobs: - test: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - - - name: Use dependencies cache - uses: actions/cache@v4 - with: - path: ~/.npm - key: npm-${{ hashFiles('package-lock.json') }} - restore-keys: npm- - - - name: Install dependencies - run: npm ci --ignore-scripts --no-audit --no-fund - - - 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 d1cdf2f..c164741 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -engine-strict = true \ No newline at end of file +min-release-age = 2 diff --git a/package-lock.json b/package-lock.json index 87a5500..f069524 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,9 +35,6 @@ "prettier": "^3.0.3", "react-scripts": "^5.0.1", "ts-jest": "^29.1.1" - }, - "engines": { - "node": ">=18.0.0" } }, "node_modules/@alloc/quick-lru": { diff --git a/package.json b/package.json index 002c6bd..febfdf9 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,6 @@ "homepage": "https://github.com/voorhoede/datocms-plugin-translate-fields", "version": "1.15.0", "description": "A DatoCMS plugin that gives you the ability to translate `structured-text`, `rich-text`, `string`, `text`, `seo` and `slug` fields in DatoCMS", - "engines": { - "node": ">=18.0.0" - }, "scripts": { "dev": "cross-env REACT_APP_USE_MOCK=true npm run start", "start": "cross-env BROWSER='none' PUBLIC_URL='/' react-scripts start", @@ -13,6 +10,7 @@ "test": "jest", "test:watch": "jest --watch", "eject": "react-scripts eject", + "lint": "prettier --check .", "prettier": "prettier --write .", "pre-commit": "npm run prettier", "prepack": "npm run build", @@ -74,7 +72,7 @@ ], "repository": { "type": "git", - "url": "https://github.com/voorhoede/datocms-plugin-translate-fields.git" + "url": "git+https://github.com/voorhoede/datocms-plugin-translate-fields.git" }, "author": "Voorhoede", "license": "ISC",