Commit f2b3233 1 parent a893e39 commit f2b3233 Copy full SHA for f2b3233
File tree 3 files changed +23
-9
lines changed
3 files changed +23
-9
lines changed Original file line number Diff line number Diff line change 15
15
required : true
16
16
type : string
17
17
description : ' A json array of releases. Required fields: publish: tagName, publishTag. publish check: pkgName, version'
18
+ secrets :
19
+ PUBLISH_TOKEN :
20
+ required : true
18
21
19
22
jobs :
20
23
publish :
21
- name : Check Publish
24
+ name : Publish
22
25
runs-on : ubuntu-latest
23
26
defaults :
24
27
run :
25
28
shell : bash
29
+ permissions :
30
+ id-token : write
26
31
steps :
27
32
- name : Checkout
28
33
uses : actions/checkout@v4
34
+ with :
35
+ ref : ${{ fromJSON(inputs.releases)[0].tagName }}
29
36
- name : Setup Git User
30
37
run : |
31
38
git config --global user.email "npm-cli+bot@github.com"
@@ -42,19 +49,21 @@ jobs:
42
49
node : ${{ steps.node.outputs.node-version }}
43
50
- name : Install Dependencies
44
51
run : npm i --ignore-scripts --no-audit --no-fund
45
- - name : Check If Published
52
+ - name : Set npm authToken
53
+ run : npm config set '//registry.npmjs.org/:_authToken'=\${PUBLISH_TOKEN}
54
+ - name : Publish
55
+ env :
56
+ PUBLISH_TOKEN : ${{ secrets.PUBLISH_TOKEN }}
57
+ RELEASES : ${{ inputs.releases }}
46
58
run : |
47
59
EXIT_CODE=0
48
60
49
61
for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
50
- SPEC=" $(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)"
51
- npm view "$SPEC" --json
62
+ PUBLISH_TAG= $(echo "$release" | base64 --decode | jq -r .publishTag)
63
+ npm publish --provenance --tag="$PUBLISH_TAG"
52
64
STATUS=$?
53
65
if [[ "$STATUS" -eq 1 ]]; then
54
66
EXIT_CODE=$STATUS
55
- echo "$SPEC ERROR"
56
- else
57
- echo "$SPEC OK"
58
67
fi
59
68
done
60
69
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ jobs:
131
131
id : comment-text
132
132
env :
133
133
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
134
- run : npm exec --offline -- template-oss-release-manager --pr="${{ needs.release.outputs.pr-number }}" --backport="" --defaultTag="latest"
134
+ run : npm exec --offline -- template-oss-release-manager --pr="${{ needs.release.outputs.pr-number }}" --backport="" --defaultTag="latest" --publish
135
135
- name : Append Release Manager Comment
136
136
uses : peter-evans/create-or-update-comment@v3
137
137
with :
@@ -243,6 +243,10 @@ jobs:
243
243
name : Release Integration
244
244
if : needs.release.outputs.releases
245
245
uses : ./.github/workflows/release-integration.yml
246
+ permissions :
247
+ id-token : write
248
+ secrets :
249
+ PUBLISH_TOKEN : ${{ secrets.PUBLISH_TOKEN }}
246
250
with :
247
251
releases : ${{ needs.release.outputs.releases }}
248
252
Original file line number Diff line number Diff line change 48
48
},
49
49
"templateOSS" : {
50
50
"//@npmcli/template-oss" : " This file is partially managed by @npmcli/template-oss. Edits may be overwritten." ,
51
- "version" : " 4.22.0"
51
+ "version" : " 4.22.0" ,
52
+ "publish" : true
52
53
},
53
54
"tap" : {
54
55
"nyc-arg" : [
You can’t perform that action at this time.
0 commit comments