Skip to content

Commit 1d489ac

Browse files
authored
chore: enable auto-publish (#161)
1 parent 24f9d37 commit 1d489ac

File tree

2 files changed

+16
-30
lines changed

2 files changed

+16
-30
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ jobs:
171171
RELEASE_COMMENT_ID: ${{ needs.release.outputs.comment-id }}
172172
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173173
run: |
174-
npm exec --offline -- template-oss-release-manager --lockfile=false --publish=false
174+
npm exec --offline -- template-oss-release-manager --lockfile=false --publish=true
175175
npm run rp-pull-request --ignore-scripts --if-present
176176
- name: Commit
177177
id: commit
@@ -320,41 +320,26 @@ jobs:
320320
defaults:
321321
run:
322322
shell: bash
323+
permissions:
324+
deployments: write
325+
id-token: write
323326
steps:
327+
- name: Checkout
328+
uses: actions/checkout@v3
329+
with:
330+
ref: ${{ fromJSON(needs.release.outputs.release).tagName }}
324331
- name: Setup Node
325332
uses: actions/setup-node@v3
326333
with:
327334
node-version: 18.x
328335
- name: Install npm@latest
329-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
330-
- name: npm Version
331-
run: npm -v
332-
- name: View in Registry
333336
run: |
334-
EXIT_CODE=0
335-
336-
function is_published {
337-
if npm view "$@" --loglevel=error > /dev/null; then
338-
echo 0
339-
else
340-
echo 1
341-
fi
342-
}
343-
344-
for release in $(echo '${{ needs.release.outputs.releases }}' | jq -r '.[] | @base64'); do
345-
name=$(echo "$release" | base64 --decode | jq -r .pkgName)
346-
version=$(echo "$release" | base64 --decode | jq -r .version)
347-
spec="$name@$version"
348-
status=$(is_published "$spec")
349-
if [[ "$status" -eq 1 ]]; then
350-
echo "$spec ERROR"
351-
EXIT_CODE=$status
352-
else
353-
echo "$spec OK"
354-
fi
355-
done
356-
357-
exit $EXIT_CODE
337+
npm i --prefer-online --no-fund --no-audit -g npm@latest
338+
npm config set '//registry.npmjs.org/:_authToken'=\${PUBLISH_TOKEN}
339+
- name: Publish
340+
env:
341+
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
342+
run: npm publish --provenance
358343

359344
post-release-integration:
360345
needs: [ release, release-integration ]

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
"templateOSS": {
4646
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
4747
"windowsCI": false,
48-
"version": "4.14.1"
48+
"version": "4.14.1",
49+
"publish": "true"
4950
},
5051
"tap": {
5152
"nyc-arg": [

0 commit comments

Comments
 (0)