Skip to content

Commit

Permalink
🔐 security: support npm package provenance (#2259)
Browse files Browse the repository at this point in the history
Support npm package provenance

See: 
- #2230
- https://docs.npmjs.com/generating-provenance-statements

## Type of change

**NONE: internal change**
  • Loading branch information
kellymears authored May 12, 2023
1 parent 86c8c0f commit 045b31f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,25 @@ on:
jobs:
release:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup
uses: actions/setup-node@v3
- uses: actions/setup-node@v3
with:
node-version: 18.12.1
node-version: 18.x
cache: yarn

- name: yarn
run: yarn
- run: npm install -g npm

- run: yarn

- name: set npmAuthToken
run: |
yarn config set npmAuthToken ${{ secrets.NODE_AUTH_TOKEN }}
- run: yarn config set npmAuthToken ${{ secrets.NODE_AUTH_TOKEN }}

- name: Release nightly
run: yarn @bud release --tag nightly --registry https://registry.npmjs.org
- run: yarn @bud release --tag nightly --registry https://registry.npmjs.org
8 changes: 6 additions & 2 deletions sources/@repo/yarn-plugin-bud/sources/command/lint.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export class Lint extends Command {
/**
* Command paths
*/
public static paths: CommandClass['paths'] = [[`@bud`, `lint`], [`@bud`, `eslint`], [`lint`]]
public static paths: CommandClass['paths'] = [
[`@bud`, `lint`],
[`@bud`, `eslint`],
[`lint`],
]

/**
* Command usage
Expand All @@ -40,7 +44,7 @@ export class Lint extends Command {
`--config`,
`./config/eslint.config.cjs`,
`--no-error-on-unmatched-pattern`,
...this.passthrough ?? [],
...(this.passthrough ?? []),
],
{stderr: this.context.stderr},
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ export class Release extends Command {
this.version = utcSemver
}
}

await this.$([`yarn`, [`@bud`, `version`, this.version]])

await this.$(
`yarn workspaces foreach --no-private npm publish --access public --tag ${this.tag}`,
`yarn workspaces foreach --no-private npm publish --access public --tag ${
this.tag
} ${
this.registry !== `http://localhost:4873` ? `--provenance` : ``
}`,
)

await this.$([`yarn`, [`@bud`, `version`, `0.0.0`]])
Expand Down

0 comments on commit 045b31f

Please sign in to comment.