Skip to content

Commit 84b2f91

Browse files
committed
♻️ Move dep-publish to a github action
1 parent 3881d12 commit 84b2f91

File tree

6 files changed

+77
-284
lines changed

6 files changed

+77
-284
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "Check deps published"
2+
inputs:
3+
dep:
4+
description: "Dependency to check"
5+
required: true
6+
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Make sure that the latest version of @huggingface/${{ inputs.dep }} is consistent with the local version
11+
run: |
12+
LOCAL_VERSION=$(node -p "require('./package.json').version")
13+
REMOTE_VERSION=$(npm view @huggingface/tasks version)
14+
15+
# If the versions are different, error
16+
if [ "$LOCAL_VERSION" != "$REMOTE_VERSION" ]; then
17+
echo "Error: The local @huggingface/$DEP package version ($LOCAL_VERSION) differs from the remote version ($REMOTE_VERSION). Release halted."
18+
exit 1
19+
fi
20+
21+
npm pack @huggingface/$DEP
22+
mv huggingface-${DEP}-$LOCAL_VERSION.tgz ${DEP}-local.tgz
23+
24+
npm pack @huggingface/${DEP}@$REMOTE_VERSION
25+
mv huggingface-${DEP}-$REMOTE_VERSION.tgz ${DEP}-remote.tgz
26+
27+
# Compute checksum of local tar. We need to extract both tar since the remote compression might be different
28+
tar -xf ${DEP}-local.tgz
29+
LOCAL_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
30+
echo "Local package checksum: $LOCAL_CHECKSUM"
31+
32+
rm -Rf package
33+
34+
tar -xf ${DEP}-remote.tgz
35+
REMOTE_CHECKSUM=$(cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1)
36+
echo "Remote package checksum: $REMOTE_CHECKSUM"
37+
38+
rm -Rf package
39+
40+
if [ "$LOCAL_CHECKSUM" != "$REMOTE_CHECKSUM" ]; then
41+
echo "Checksum Verification Failed: The local @huggingface/$DEPS package differs from the remote version. Release halted. Local Checksum: $LOCAL_CHECKSUM, Remote Checksum: $REMOTE_CHECKSUM"
42+
exit 1
43+
fi
44+
echo "Checksum Verification Successful: The local and remote @huggingface/$DEPS packages are consistent. Local Checksum: $LOCAL_CHECKSUM, Remote Checksum: $REMOTE_CHECKSUM."
45+
working-directory: packages/${{ inputs.dep }}
46+
env:
47+
DEP: ${{ inputs.dep }}

.github/workflows/hub-publish.yml

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -53,42 +53,9 @@ 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+
- uses: ./.github/actions/check-deps-published
57+
with:
58+
dep: tasks
9259

9360
- run: pnpm publish --no-git-checks .
9461
env:

.github/workflows/inference-publish.yml

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -53,42 +53,9 @@ 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+
- uses: ./.github/actions/check-deps-published
57+
with:
58+
dep: tasks
9259

9360
- run: pnpm publish --no-git-checks .
9461
env:

.github/workflows/tasks-publish.yml

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -50,42 +50,9 @@ 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+
- uses: ./.github/actions/check-deps-published
54+
with:
55+
dep: gguf
8956

9057
- run: pnpm publish --no-git-checks .
9158
env:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: test-check-deps
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
version_and_release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- run: corepack enable
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: "20"
15+
cache: "pnpm"
16+
- uses: ./.github/actions/check-deps-published
17+
with:
18+
dep: hub
19+
- uses: ./.github/actions/check-deps-published
20+
with:
21+
dep: tasks

.github/workflows/widgets-publish.yml

Lines changed: 0 additions & 176 deletions
This file was deleted.

0 commit comments

Comments
 (0)