Skip to content

Commit cdc754e

Browse files
authored
Merge pull request #1848 from finos/fix-release-workflow
Fix release workflow
2 parents 21c464e + f0bc92f commit cdc754e

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Configure Node
2525
uses: actions/setup-node@v4
2626
with:
27-
node-version: 20
27+
node-version: 22
2828

2929
- name: Install dependencies
3030
run: npm ci
@@ -43,7 +43,7 @@ jobs:
4343
id: version
4444
run: |
4545
set -euo pipefail
46-
VERSION="$(node -p 'require("./package.json").version')"
46+
VERSION="$(node -p 'JSON.parse(require("fs").readFileSync("./package.json","utf8")).version')"
4747
echo "Detected version: $VERSION"
4848
4949
# If version contains a hyphen, it's a prerelease (e.g., 1.2.3-alpha.1)
@@ -61,7 +61,15 @@ jobs:
6161
- name: Pack workspaces (skip private)
6262
run: |
6363
set -euo pipefail
64-
for ws in $(npm query ':not(.private)' --workspaces | jq -r '.[].location'); do
64+
for ws in $(node -e '
65+
const fs = require("fs");
66+
const read = (p) => JSON.parse(fs.readFileSync(p, "utf8"));
67+
const root = read("./package.json");
68+
for (const dir of root.workspaces || []) {
69+
const pkg = read("./" + dir + "/package.json");
70+
if (!pkg.private) console.log(dir);
71+
}
72+
'); do
6573
echo "Packing $ws ..."
6674
npm pack --workspace "$ws"
6775
done
@@ -82,6 +90,9 @@ jobs:
8290
runs-on: ubuntu-latest
8391
needs: build_and_pack
8492
steps:
93+
- name: Checkout repo (required for npm provenance)
94+
uses: actions/checkout@v4
95+
8596
- name: Download packed artifacts
8697
uses: actions/download-artifact@v4
8798
with:
@@ -91,7 +102,7 @@ jobs:
91102
- name: Configure Node for npmjs.org
92103
uses: actions/setup-node@v4
93104
with:
94-
node-version: 20
105+
node-version: 22
95106
registry-url: https://registry.npmjs.org
96107
always-auth: true
97108

@@ -102,7 +113,7 @@ jobs:
102113
run: |
103114
set -euo pipefail
104115
shopt -s nullglob
105-
for tgz in dist-tarballs/*.tgz; do
116+
for tgz in ./dist-tarballs/*.tgz; do
106117
echo "Publishing $tgz to npmjs.org with tag '${PUBLISH_TAG}' ..."
107118
# --access public needed for first publish of public packages
108119
npm publish "$tgz" --provenance --access public --tag "${PUBLISH_TAG}"
@@ -122,7 +133,7 @@ jobs:
122133
- name: Configure Node for GitHub Packages
123134
uses: actions/setup-node@v4
124135
with:
125-
node-version: 20
136+
node-version: 22
126137
registry-url: https://npm.pkg.github.com
127138
scope: '@finos'
128139
always-auth: true
@@ -134,7 +145,8 @@ jobs:
134145
run: |
135146
set -euo pipefail
136147
shopt -s nullglob
137-
for tgz in dist-tarballs/*.tgz; do
148+
for tgz in ./dist-tarballs/*.tgz; do
138149
echo "Publishing $tgz to GitHub Packages with tag '${PUBLISH_TAG}' ..."
139150
# GitHub Packages does not support npm provenance; omit --provenance and --access
140151
npm publish "$tgz" --tag "${PUBLISH_TAG}"
152+
done

0 commit comments

Comments
 (0)