@@ -16,48 +16,24 @@ jobs:
16
16
environment : npm
17
17
permissions :
18
18
contents : write # for creating new release
19
- id-token : write # for CFA
19
+ id-token : write # for publishing releases
20
20
steps :
21
21
- uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
22
22
- name : " Use Node.js ${{ matrix.node-version }}"
23
23
uses : actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
24
24
with :
25
- node-version : " 20.16.0"
25
+ node-version : " 20.17.0"
26
+ - name : Update npm to version that supports trusted publishing
27
+ run : npm install -g npm@^11.5.1
26
28
- name : Update Version
27
29
run : node script/update-version.js ${{ github.ref_name }}
28
30
- name : Confirm Version Updated
29
31
run : node -e "if (require('./package.json').version === '0.0.0-development') process.exit(1)"
30
32
- name : Install Dependencies
31
33
run : npm ci
32
- - name : Obtain OIDC token
33
- id : oidc
34
- run : |
35
- token=$(curl --fail -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
36
- "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=continuousauth.dev" | jq -r '.value')
37
- echo "::add-mask::${token}"
38
- echo "token=${token}" >> $GITHUB_OUTPUT
39
- - name : Obtain GitHub credentials
40
- id : github_creds
41
- run : |
42
- token=$(curl --fail "https://continuousauth.dev/api/request/${{ secrets.CFA_PROJECT_ID }}/github/credentials" \
43
- -X POST \
44
- -H "Content-Type: application/json" \
45
- -H "Authorization: bearer ${{ secrets.CFA_SECRET }}" \
46
- --data "{\"token\":\"${{ steps.oidc.outputs.token }}\"}" | jq -r '.GITHUB_TOKEN')
47
- echo "::add-mask::${token}"
48
- echo "token=${token}" >> $GITHUB_OUTPUT
49
- - name : Set NPM Credentials
50
- run : echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} > ~/.npmrc
51
- - name : Check NPM Credentials
52
- run : npm whoami
53
- - name : CFA Publish
54
- timeout-minutes : 60
55
- env :
56
- CFA_PROJECT_ID : ${{ secrets.CFA_PROJECT_ID }}
57
- CFA_SECRET : ${{ secrets.CFA_SECRET }}
58
- GITHUB_OIDC_TOKEN : ${{ steps.oidc.outputs.token }}
59
- run : node script/publish.js
34
+ - name : Publish to npm
35
+ run : npm publish
60
36
- name : Create Release
61
37
env :
62
- GITHUB_TOKEN : ${{ steps.github_creds.outputs.token }}
38
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
63
39
run : gh release create ${{ github.ref_name }} -t ${{ github.ref_name }}
0 commit comments