Skip to content

Commit 05f67ef

Browse files
Fix publish workflow with manual artifact handling (#7)
* Fix publish workflow with manual artifact handling Signed-off-by: teodordelibasic-db <[email protected]> * Use npm provenance for publishing with OIDC Signed-off-by: teodordelibasic-db <[email protected]> --------- Signed-off-by: teodordelibasic-db <[email protected]>
1 parent 62d6fde commit 05f67ef

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

.github/workflows/publish.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
release:
55
types: [published]
66

7+
permissions:
8+
contents: read
9+
id-token: write
10+
711
jobs:
812
build:
913
strategy:
@@ -90,20 +94,40 @@ jobs:
9094

9195
- name: Download all artifacts
9296
uses: actions/download-artifact@v4
97+
with:
98+
path: artifacts
9399

94100
- name: List downloaded artifacts
95-
run: ls -la
96-
97-
- name: Prepare npm packages
98-
run: npx napi prepublish -t npm
101+
run: ls -R artifacts/
99102

100103
- name: Move artifacts to npm packages
101-
run: npx napi artifacts
104+
run: |
105+
# Create npm directories for each platform we're building
106+
mkdir -p npm/linux-x64-gnu npm/linux-arm64-gnu npm/win32-x64-msvc
107+
108+
# Copy artifacts to correct locations
109+
cp artifacts/bindings-x86_64-unknown-linux-gnu/*.node npm/linux-x64-gnu/
110+
cp artifacts/bindings-aarch64-unknown-linux-gnu/*.node npm/linux-arm64-gnu/
111+
cp artifacts/bindings-x86_64-pc-windows-msvc/*.node npm/win32-x64-msvc/
112+
113+
# Create package.json for each platform package
114+
for dir in npm/*/; do
115+
platform=$(basename "$dir")
116+
cat > "$dir/package.json" << EOF
117+
{
118+
"name": "@databricks/zerobus-sdk-$platform",
119+
"version": "0.1.0",
120+
"os": ["${platform%%-*}"],
121+
"cpu": ["${platform#*-}"],
122+
"main": "zerobus-sdk-ts.$platform.node"
123+
}
124+
EOF
125+
done
102126
103127
- name: List packages
104128
run: ls -R ./npm
105129

106130
- name: Publish
107-
run: npm publish --access public --ignore-scripts
131+
run: npm publish --access public --provenance
108132
env:
109133
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)