From 0a2bd7f54b102110231e7ca802092c5d62b748a4 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Wed, 5 Jun 2024 23:25:07 +0100 Subject: [PATCH] feat: add support for prereleases (#19) --- .github/workflows/publish.yml | 23 ++++++++++++++++------- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1d88b9b..bbbbe86 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,15 +26,24 @@ jobs: publish-npm: needs: build runs-on: ubuntu-latest + permissions: + id-token: write steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 20 - registry-url: https://registry.npmjs.org/ - - name: Install Dependencies - run: npm ci - - name: Publish - run: npm publish + node-version: 22.x + registry-url: 'https://registry.npmjs.org' + cache: 'npm' + - run: npm ci + - run: npm version ${TAG_NAME} --git-tag-version=false + env: + TAG_NAME: ${{ github.ref_name }} + - run: npm publish --provenance --access public --tag next + if: "github.event.release.prerelease" + env: + NODE_AUTH_TOKEN: ${{ secrets.npm_token }} + - run: npm publish --provenance --access public + if: "!github.event.release.prerelease" env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + NODE_AUTH_TOKEN: ${{ secrets.npm_token }} diff --git a/package-lock.json b/package-lock.json index 7bf7e2d..dd653c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "eslint-plugin-depend", - "version": "0.7.0", + "version": "0.0.0-dev", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "eslint-plugin-depend", - "version": "0.7.0", + "version": "0.0.0-dev", "license": "MIT", "dependencies": { "fd-package-json": "^1.2.0", diff --git a/package.json b/package.json index 8082b5d..c9bf01d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-depend", - "version": "0.7.0", + "version": "0.0.0-dev", "description": "An ESLint plugin to suggest optimized dependencies, native alternatives and more", "main": "lib/main.js", "files": [