Skip to content

Commit 7d16103

Browse files
committed
chore(repo): setup for oidc
1 parent c8e78c8 commit 7d16103

3 files changed

Lines changed: 55 additions & 21 deletions

File tree

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@ on:
55
branches:
66
- master
77

8+
permissions:
9+
# Jobs requiring OIDC (e.g., npm publish) must request `id-token: write` at the job level.
10+
contents: read
11+
pages: write
12+
813
jobs:
914
publish:
1015
# let's ignore release commits, otherwise it'll try to run twice
1116
if: |
1217
!startsWith(github.event.head_commit.message , 'chore(release):') &&
1318
!startsWith(github.event.head_commit.message , 'chore(repo):')
1419
20+
permissions:
21+
# Required for `versioner` to push release commits/tags and for npm OIDC publish.
22+
contents: write
23+
id-token: write
24+
1525
runs-on: ubuntu-latest
1626

1727
name: release
@@ -81,6 +91,17 @@ jobs:
8191
- name: Run Tests
8292
run: pnpm --filter [HEAD^] test
8393

94+
- name: OIDC Preflight
95+
shell: bash
96+
run: |
97+
if [ -z "${ACTIONS_ID_TOKEN_REQUEST_URL:-}" ] || [ -z "${ACTIONS_ID_TOKEN_REQUEST_TOKEN:-}" ]; then
98+
echo "Missing GitHub Actions OIDC env vars (ACTIONS_ID_TOKEN_REQUEST_URL/TOKEN)." >&2
99+
echo "Ensure the job requests permissions: id-token: write." >&2
100+
exit 1
101+
fi
102+
103+
echo "OIDC env vars detected."
104+
84105
- name: Release and Publish Packages
85106
run: pnpm --filter [HEAD^] --workspace-concurrency=1 release
86107
env:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"security": "pnpm audit --audit-level=high"
1818
},
1919
"devDependencies": {
20-
"@dot/versioner": "^0.3.1",
20+
"@dot/versioner": "^0.4.3",
2121
"@rollup/plugin-typescript": "^9.0.1",
2222
"@types/node": "^20.19.0",
2323
"@types/source-map-support": "^0.5.4",

pnpm-lock.yaml

Lines changed: 33 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)