Skip to content

Commit b620ee2

Browse files
authored
🦺 Make sure latest version of jina is published when pubishing widgets (#492)
cc @Wauplin @SBrandeis will probably need to do the same with inference if/when adding it as a dep to widgets (we could probably streamline it with a matrix or separate github action that we can call)
1 parent f16c796 commit b620ee2

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

‎.github/workflows/widgets-publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,43 @@ jobs:
8787
echo "Checksum Verification Successful: The local and remote @huggingface/tasks packages are consistent. Proceeding with the @huggingface/widgets package release. Local Checksum: $LOCAL_CHECKSUM, Remote Checksum: $REMOTE_CHECKSUM."
8888
working-directory: packages/tasks
8989

90+
- name: Make sure that the latest version of @huggingface/jinja is consistent with the local version
91+
run: |
92+
LOCAL_JINJA_VERSION=$(node -p "require('./package.json').version")
93+
REMOTE_JINJA_VERSION=$(npm view @huggingface/jinja version)
94+
95+
# If the versions are different, error
96+
if [ "$LOCAL_JINJA_VERSION" != "$REMOTE_JINJA_VERSION" ]; then
97+
echo "Error: The local @huggingface/jinja package version ($LOCAL_JINJA_VERSION) differs from the remote version ($REMOTE_JINJA_VERSION). Release halted."
98+
exit 1
99+
fi
100+
101+
npm pack @huggingface/jinja
102+
mv huggingface-jinja-$LOCAL_JINJA_VERSION.tgz jinja-local.tgz
103+
104+
npm pack @huggingface/jinja@$REMOTE_JINJA_VERSION
105+
mv huggingface-jinja-$REMOTE_JINJA_VERSION.tgz jinja-remote.tgz
106+
107+
# Compute checksum of local tar. We need to extract both tar since the remote compression might be different
108+
tar -xf jinja-local.tgz
109+
LOCAL_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
110+
echo "Local package checksum: $LOCAL_CHECKSUM"
111+
112+
rm -Rf package
113+
114+
tar -xf jinja-remote.tgz
115+
REMOTE_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
116+
echo "Remote package checksum: $REMOTE_CHECKSUM"
117+
118+
rm -Rf package
119+
120+
if [ "$LOCAL_CHECKSUM" != "$REMOTE_CHECKSUM" ]; then
121+
echo "Checksum Verification Failed: The local @huggingface/jinja package differs from the remote version. Release halted. Local Checksum: $LOCAL_CHECKSUM, Remote Checksum: $REMOTE_CHECKSUM"
122+
exit 1
123+
fi
124+
echo "Checksum Verification Successful: The local and remote @huggingface/jinja packages are consistent. Proceeding with the @huggingface/widgets package release. Local Checksum: $LOCAL_CHECKSUM, Remote Checksum: $REMOTE_CHECKSUM."
125+
working-directory: packages/jinja
126+
90127
- run: pnpm publish --no-git-checks .
91128
env:
92129
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

‎packages/jinja/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"format": "prettier --write .",
2929
"format:check": "prettier --check .",
3030
"prepublishOnly": "pnpm run build",
31+
"prepare": "pnpm run build",
3132
"build": "tsup src/index.ts --format cjs,esm --clean --dts",
3233
"test": "vitest run",
3334
"test:browser": "vitest run --browser.name=chrome --browser.headless",

0 commit comments

Comments
 (0)