Skip to content

Commit 35f5242

Browse files
authored
Update npm-publish.yml
1 parent 736e7b2 commit 35f5242

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

.github/workflows/npm-publish.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: npm publish (dry run)
1+
name: npm publish
22

33
# Packages are intentionally not published by this workflow yet. Once the
44
# generated package contents have been verified, remove --dry-run from the
@@ -73,3 +73,29 @@ jobs:
7373
env:
7474
# npm checks authentication even for a publish dry run.
7575
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
76+
77+
- name: Publish npm packages
78+
shell: bash
79+
run: |
80+
set -euo pipefail
81+
82+
mapfile -t packages < <(
83+
npm query .workspace --json | node -e '
84+
let input = "";
85+
process.stdin.on("data", chunk => input += chunk);
86+
process.stdin.on("end", () => {
87+
for (const workspace of JSON.parse(input)) {
88+
if (!workspace.private) console.log(workspace.name);
89+
}
90+
});
91+
'
92+
)
93+
94+
for package in "${packages[@]}"; do
95+
echo "::group::${package}"
96+
npm publish --workspace "${package}" --access public
97+
echo "::endgroup::"
98+
done
99+
env:
100+
# npm checks authentication even for a publish.
101+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)