-
Notifications
You must be signed in to change notification settings - Fork 340
Use NPM trusted publishing #725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
843b039
401bf68
c559dd7
b3f1939
780fe0b
03bb90d
a755395
1124b06
f2c7400
58f3fc9
00b792f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,14 +181,18 @@ jobs: | |
| name: NPM | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - run: corepack enable | ||
|
|
||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 20 | ||
| registry-url: https://registry.npmjs.org | ||
| cache: npm | ||
| cache-dependency-path: typescript/package-lock.json | ||
|
|
||
|
|
@@ -208,25 +212,5 @@ jobs: | |
| working-directory: typescript | ||
|
|
||
| - run: npm run publish | ||
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
| # if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
| working-directory: typescript | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
|
|
||
| dependabot: | ||
| name: Dependabot | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: write | ||
| if: github.event.pull_request.user.login == 'dependabot[bot]' | ||
| steps: | ||
| - name: Automatically approve dependabot PRs | ||
| uses: octokit/[email protected] | ||
| with: | ||
| route: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews | ||
| owner: ${{ github.event.repository.owner.login }} | ||
| repo: ${{ github.event.repository.name }} | ||
| pull_number: ${{ github.event.pull_request.number }} | ||
| event: APPROVE | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: Dependabot | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| approve: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: write | ||
| if: github.event.pull_request.user.login == 'dependabot[bot]' | ||
| steps: | ||
| - name: Approve Dependabot PR | ||
| uses: octokit/[email protected] | ||
| with: | ||
| route: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews | ||
| owner: ${{ github.event.repository.owner.login }} | ||
| repo: ${{ github.event.repository.name }} | ||
| pull_number: ${{ github.event.pull_request.number }} | ||
| event: APPROVE | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package dbmate | ||
|
|
||
| // Version of dbmate | ||
| const Version = "2.29.0" | ||
| const Version = "2.29.1" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| { | ||
| "private": true, | ||
| "packageManager": "[email protected]", | ||
| "scripts": { | ||
| "clean": "rimraf dist packages/dbmate/dist", | ||
| "lint": "eslint --report-unused-disable-directives --fix .", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,18 @@ async function main() { | |
| ); | ||
|
|
||
| for (const pkg of packages) { | ||
| await exec("npm", ["publish", "--access", "public", pkg]); | ||
| // Unset NODE_AUTH_TOKEN to avoid conflicts with OIDC trusted publishing | ||
| delete process.env.NODE_AUTH_TOKEN; | ||
| await exec("corepack", ["npm", "--version"]); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Debug version check runs redundantly inside publish loopLow Severity A debugging statement |
||
| await exec("corepack", [ | ||
| "npm", | ||
| "publish", | ||
| "--dry-run", | ||
cursor[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "--provenance", | ||
| "--access", | ||
| "public", | ||
| pkg, | ||
| ]); | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.