Skip to content

Commit bea67bb

Browse files
authored
Use GitHub OIDC for publishing (#9781)
Co-authored-by: Daniel Cousens <dcousens@users.noreply.github.com>
1 parent 36a2ff0 commit bea67bb

File tree

2 files changed

+28
-49
lines changed

2 files changed

+28
-49
lines changed

.github/workflows/publish.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ name: Publish
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'The npm tag to publish to'
8+
required: true
9+
type: choice
10+
options:
11+
- latest
12+
- rc
13+
14+
permissions:
15+
id-token: write
16+
contents: write
517

618
jobs:
719
publish:
@@ -21,11 +33,23 @@ jobs:
2133
git config --global user.name 'Keystonejs Release Bot'
2234
git config --global user.email 'automation+keystonejs@thinkmill.com.au'
2335
36+
- name: version packages
37+
if: inputs.tag != 'latest'
38+
run: |
39+
pnpm changeset version --snapshot ${{ inputs.tag }}
40+
git commit -a -m 'rc'
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
2444
- run: pnpm build
2545

2646
- name: npm publish, git tag
27-
run: pnpm changeset publish
28-
env:
29-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
run: pnpm changeset publish --tag ${{ inputs.tag }}
48+
49+
# reset, then we have a tagged dangling commit
50+
- name: git push
51+
if: inputs.tag != 'latest'
52+
run: |
53+
git reset HEAD~1 --hard
3054
31-
- run: git push origin --follow-tags
55+
- run: git push origin --tags

.github/workflows/publish_snapshot.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)