Skip to content

Commit 3d57fa0

Browse files
authored
♻️ Move dep-publish to a github action (huggingface#1002)
Preparation for huggingface#1000
1 parent 3881d12 commit 3d57fa0

File tree

7 files changed

+83
-307
lines changed

7 files changed

+83
-307
lines changed

.github/workflows/hub-publish.yml

+2-36
Original file line numberDiff line numberDiff line change
@@ -53,42 +53,8 @@ jobs:
5353
git commit -m "🔖 @huggingface/hub $BUMPED_VERSION"
5454
git tag "hub-v$BUMPED_VERSION"
5555
56-
- name: Make sure that the latest version of @huggingface/tasks is consistent with the local version
57-
run: |
58-
LOCAL_TASKS_VERSION=$(node -p "require('./package.json').version")
59-
REMOTE_TASKS_VERSION=$(npm view @huggingface/tasks version)
60-
61-
# If the versions are different, error
62-
if [ "$LOCAL_TASKS_VERSION" != "$REMOTE_TASKS_VERSION" ]; then
63-
echo "Error: The local @huggingface/tasks package version ($LOCAL_TASKS_VERSION) differs from the remote version ($REMOTE_TASKS_VERSION). Release halted."
64-
exit 1
65-
fi
66-
67-
npm pack @huggingface/tasks
68-
mv huggingface-tasks-$LOCAL_TASKS_VERSION.tgz tasks-local.tgz
69-
70-
npm pack @huggingface/tasks@$REMOTE_TASKS_VERSION
71-
mv huggingface-tasks-$REMOTE_TASKS_VERSION.tgz tasks-remote.tgz
72-
73-
# Compute checksum of local tar. We need to extract both tar since the remote compression might be different
74-
tar -xf tasks-local.tgz
75-
LOCAL_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
76-
echo "Local package checksum: $LOCAL_CHECKSUM"
77-
78-
rm -Rf package
79-
80-
tar -xf tasks-remote.tgz
81-
REMOTE_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
82-
echo "Remote package checksum: $REMOTE_CHECKSUM"
83-
84-
rm -Rf package
85-
86-
if [ "$LOCAL_CHECKSUM" != "$REMOTE_CHECKSUM" ]; then
87-
echo "Checksum Verification Failed: The local @huggingface/tasks package differs from the remote version. Release halted. Local Checksum: $LOCAL_CHECKSUM, Remote Checksum: $REMOTE_CHECKSUM"
88-
exit 1
89-
fi
90-
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."
91-
working-directory: packages/tasks
56+
- name: "Check Deps are published before publishing this package"
57+
run: pnpm -w check-deps tasks
9258

9359
- run: pnpm publish --no-git-checks .
9460
env:

.github/workflows/inference-publish.yml

+2-36
Original file line numberDiff line numberDiff line change
@@ -53,42 +53,8 @@ jobs:
5353
git commit -m "🔖 @huggingface/inference $BUMPED_VERSION"
5454
git tag "inference-v$BUMPED_VERSION"
5555
56-
- name: Make sure that the latest version of @huggingface/tasks is consistent with the local version
57-
run: |
58-
LOCAL_TASKS_VERSION=$(node -p "require('./package.json').version")
59-
REMOTE_TASKS_VERSION=$(npm view @huggingface/tasks version)
60-
61-
# If the versions are different, error
62-
if [ "$LOCAL_TASKS_VERSION" != "$REMOTE_TASKS_VERSION" ]; then
63-
echo "Error: The local @huggingface/tasks package version ($LOCAL_TASKS_VERSION) differs from the remote version ($REMOTE_TASKS_VERSION). Release halted."
64-
exit 1
65-
fi
66-
67-
npm pack @huggingface/tasks
68-
mv huggingface-tasks-$LOCAL_TASKS_VERSION.tgz tasks-local.tgz
69-
70-
npm pack @huggingface/tasks@$REMOTE_TASKS_VERSION
71-
mv huggingface-tasks-$REMOTE_TASKS_VERSION.tgz tasks-remote.tgz
72-
73-
# Compute checksum of local tar. We need to extract both tar since the remote compression might be different
74-
tar -xf tasks-local.tgz
75-
LOCAL_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
76-
echo "Local package checksum: $LOCAL_CHECKSUM"
77-
78-
rm -Rf package
79-
80-
tar -xf tasks-remote.tgz
81-
REMOTE_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
82-
echo "Remote package checksum: $REMOTE_CHECKSUM"
83-
84-
rm -Rf package
85-
86-
if [ "$LOCAL_CHECKSUM" != "$REMOTE_CHECKSUM" ]; then
87-
echo "Checksum Verification Failed: The local @huggingface/tasks package differs from the remote version. Release halted. Local Checksum: $LOCAL_CHECKSUM, Remote Checksum: $REMOTE_CHECKSUM"
88-
exit 1
89-
fi
90-
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."
91-
working-directory: packages/tasks
56+
- name: "Check Deps are published before publishing this package"
57+
run: pnpm -w check-deps gguf
9258

9359
- run: pnpm publish --no-git-checks .
9460
env:

.github/workflows/tasks-publish.yml

+2-36
Original file line numberDiff line numberDiff line change
@@ -50,42 +50,8 @@ jobs:
5050
git commit . -m "🔖 @huggingface/tasks $BUMPED_VERSION"
5151
git tag "tasks-v$BUMPED_VERSION"
5252
53-
- name: Make sure that the latest version of @huggingface/gguf is consistent with the local version
54-
run: |
55-
LOCAL_GGUF_VERSION=$(node -p "require('./package.json').version")
56-
REMOTE_GGUF_VERSION=$(npm view @huggingface/gguf version)
57-
58-
# If the versions are different, error
59-
if [ "$LOCAL_GGUF_VERSION" != "$REMOTE_GGUF_VERSION" ]; then
60-
echo "Error: The local @huggingface/gguf package version ($LOCAL_GGUF_VERSION) differs from the remote version ($REMOTE_GGUF_VERSION). Release halted."
61-
exit 1
62-
fi
63-
64-
npm pack @huggingface/gguf
65-
mv huggingface-gguf-$LOCAL_GGUF_VERSION.tgz gguf-local.tgz
66-
67-
npm pack @huggingface/gguf@$REMOTE_GGUF_VERSION
68-
mv huggingface-gguf-$REMOTE_GGUF_VERSION.tgz gguf-remote.tgz
69-
70-
# Compute checksum of local tar. We need to extract both tar since the remote compression might be different
71-
tar -xf gguf-local.tgz
72-
LOCAL_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
73-
echo "Local package checksum: $LOCAL_CHECKSUM"
74-
75-
rm -Rf package
76-
77-
tar -xf gguf-remote.tgz
78-
REMOTE_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
79-
echo "Remote package checksum: $REMOTE_CHECKSUM"
80-
81-
rm -Rf package
82-
83-
if [ "$LOCAL_CHECKSUM" != "$REMOTE_CHECKSUM" ]; then
84-
echo "Checksum Verification Failed: The local @huggingface/gguf package differs from the remote version. Release halted. Local Checksum: $LOCAL_CHECKSUM, Remote Checksum: $REMOTE_CHECKSUM"
85-
exit 1
86-
fi
87-
echo "Checksum Verification Successful: The local and remote @huggingface/gguf packages are consistent. Proceeding with the @huggingface/widgets package release. Local Checksum: $LOCAL_CHECKSUM, Remote Checksum: $REMOTE_CHECKSUM."
88-
working-directory: packages/gguf
53+
- name: "Check Deps are published before publishing this package"
54+
run: pnpm -w check-deps gguf
8955

9056
- run: pnpm publish --no-git-checks .
9157
env:

.github/workflows/widgets-publish.yml

-176
This file was deleted.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
"lint": "eslint --quiet --fix --ext .cjs,.ts .eslintrc.cjs",
88
"lint:check": "eslint --ext .cjs,.ts .eslintrc.cjs",
99
"format": "prettier --write package.json .prettierrc .vscode .eslintrc.cjs e2e .github *.md",
10-
"format:check": "prettier --check package.json .prettierrc .vscode .eslintrc.cjs .github *.md"
10+
"format:check": "prettier --check package.json .prettierrc .vscode .eslintrc.cjs .github *.md",
11+
"check-deps": "tsx scripts/check-deps.ts"
1112
},
1213
"devDependencies": {
1314
"@typescript-eslint/eslint-plugin": "^7.2.0",
1415
"@typescript-eslint/parser": "^7.2.0",
16+
"@types/node": "^18.16.1",
1517
"@vitest/browser": "^0.34.6",
1618
"eslint": "^8.57.0",
1719
"eslint-config-prettier": "^9.0.0",

0 commit comments

Comments
 (0)