diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9491db2..346fff5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,26 +29,17 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20.17.0 - registry-url: 'https://registry.npmjs.org' + node-version: "22" + registry-url: "https://registry.npmjs.org" - name: Install pnpm uses: pnpm/action-setup@v2 with: version: 10.12.2 - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v3 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + # npm 11.5.1 or later is required for trusted publishing + - name: Update npm + run: npm install -g npm@latest - name: Install dependencies run: pnpm install --frozen-lockfile @@ -60,9 +51,7 @@ jobs: run: pnpm run build - name: Publish to NPM - run: pnpm publish --access public --no-git-checks --provenance - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: pnpm publish --access public --no-git-checks # ========================================== # Job 2: Build binaries for all platforms @@ -73,8 +62,8 @@ jobs: # SECURITY: Only grant write permission where needed permissions: contents: write - attestations: write # SECURITY: For artifact attestation - id-token: write # SECURITY: For OIDC signing + attestations: write # SECURITY: For artifact attestation + id-token: write # SECURITY: For OIDC signing strategy: matrix: @@ -99,7 +88,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '22' + node-version: "22" - name: Install pnpm uses: pnpm/action-setup@v2 @@ -167,7 +156,7 @@ jobs: - name: Generate artifact attestation uses: actions/attest-build-provenance@v2 with: - subject-path: 'shield-*' + subject-path: "shield-*" - name: Upload binary and checksum to Release uses: softprops/action-gh-release@v2 @@ -176,4 +165,4 @@ jobs: shield-${{ matrix.platform }}-${{ matrix.arch }}${{ matrix.platform == 'win32' && '.exe' || '' }} shield-${{ matrix.platform }}-${{ matrix.arch }}${{ matrix.platform == 'win32' && '.exe' || '' }}.sha256 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 1271c0a..dd35195 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "license": "MIT", "author": "Yield.xyz", "publishConfig": { - "access": "public" + "access": "public", + "registry": "https://registry.npmjs.org/" }, "bin": { "shield": "./dist/cli.js"