Skip to content

Commit 5480956

Browse files
authored
update widgets-publish workflow (#500)
1 parent af44775 commit 5480956

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/widgets-publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,43 @@ jobs:
124124
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."
125125
working-directory: packages/jinja
126126

127+
- name: Make sure that the latest version of @huggingface/inference is consistent with the local version
128+
run: |
129+
LOCAL_INFERENCE_VERSION=$(node -p "require('./package.json').version")
130+
REMOTE_INFERENCE_VERSION=$(npm view @huggingface/inference version)
131+
132+
# If the versions are different, error
133+
if [ "$LOCAL_INFERENCE_VERSION" != "$REMOTE_INFERENCE_VERSION" ]; then
134+
echo "Error: The local @huggingface/inference package version ($LOCAL_INFERENCE_VERSION) differs from the remote version ($REMOTE_INFERENCE_VERSION). Release halted."
135+
exit 1
136+
fi
137+
138+
npm pack @huggingface/inference
139+
mv huggingface-inference-$LOCAL_INFERENCE_VERSION.tgz inference-local.tgz
140+
141+
npm pack @huggingface/inference@$REMOTE_INFERENCE_VERSION
142+
mv huggingface-inference-$REMOTE_INFERENCE_VERSION.tgz inference-remote.tgz
143+
144+
# Compute checksum of local tar. We need to extract both tar since the remote compression might be different
145+
tar -xf inference-local.tgz
146+
LOCAL_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
147+
echo "Local package checksum: $LOCAL_CHECKSUM"
148+
149+
rm -Rf package
150+
151+
tar -xf inference-remote.tgz
152+
REMOTE_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
153+
echo "Remote package checksum: $REMOTE_CHECKSUM"
154+
155+
rm -Rf package
156+
157+
if [ "$LOCAL_CHECKSUM" != "$REMOTE_CHECKSUM" ]; then
158+
echo "Checksum Verification Failed: The local @huggingface/inference package differs from the remote version. Release halted. Local Checksum: $LOCAL_CHECKSUM, Remote Checksum: $REMOTE_CHECKSUM"
159+
exit 1
160+
fi
161+
echo "Checksum Verification Successful: The local and remote @huggingface/inference packages are consistent. Proceeding with the @huggingface/widgets package release. Local Checksum: $LOCAL_CHECKSUM, Remote Checksum: $REMOTE_CHECKSUM."
162+
working-directory: packages/inference
163+
127164
- run: pnpm publish --no-git-checks .
128165
env:
129166
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)