Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions scripts/repush_not_exist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Traverse the k8s directory under kcl-artifacthub
find $(pwd) -mindepth 1 -maxdepth 2 -type d | while read -r dir; do
# Check if the .mod file exists in the current directory
if [ -f "$dir/kcl.mod" ]; then
echo "Contents of $dir/kcl.mod:"

# Extract and print the 'name' field
name=$(grep -m 1 '^name' "$dir/kcl.mod" | awk -F '=' '{print $2}' | xargs)
# Extract and print the 'version' field
version=$(grep -m 1 '^version' "$dir/kcl.mod" | awk -F '=' '{print $2}' | xargs)

IMAGE_EXIST=`oras manifest fetch ghcr.io/kcl-lang/$name:$version | grep mediaType | wc -l `
if [ $IMAGE_EXIST -eq 1 ]; then
echo ""
else
echo "$name:$version is not exist!"
./scripts/push_pkg_from.sh $dir/kcl.mod
fi
fi
done