Skip to content

Commit 186caa0

Browse files
feat(security): Add provenance (#339)
* Enable provenance in package.json * Add necessary permissions to the release workflow * Add provenance to project init * style: prettier --------- Co-authored-by: wolfy1339 <[email protected]>
1 parent 038bd5e commit 186caa0

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ name: Release
33
push:
44
branches:
55
- main
6+
# These are recommended by the semantic-release docs: https://github.com/semantic-release/npm#npm-provenance
7+
permissions:
8+
contents: write # to be able to publish a GitHub release
9+
issues: write # to be able to comment on released issues
10+
pull-requests: write # to be able to comment on released pull requests
11+
id-token: write # to enable use of OIDC for npm provenance
12+
613
jobs:
714
release:
815
name: release

lib/create-package-json.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ async function createPackageJson(answers) {
7171
if (answers.publicAccess) {
7272
pkg.publishConfig = {
7373
access: "public",
74+
provenance: true,
7475
};
7576
}
7677

lib/create-release-action.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ on:
1515
- next
1616
- beta
1717
- "*.x" # maintenance release branches, e.g. v1.x
18+
# These are recommended by the semantic-release docs: https://github.com/semantic-release/npm#npm-provenance
19+
permissions:
20+
contents: write # to be able to publish a GitHub release
21+
issues: write # to be able to comment on released issues
22+
pull-requests: write # to be able to comment on released pull requests
23+
id-token: write # to enable use of OIDC for npm provenance
1824
1925
jobs:
2026
release:

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,8 @@
3636
},
3737
"engines": {
3838
"node": ">= 18"
39+
},
40+
"publishConfig": {
41+
"provenance": true
3942
}
4043
}

0 commit comments

Comments
 (0)