2024-01-06 08:07:05 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-05-16 17:20:33 -04:00
|
|
|
USER=zerotier
|
|
|
|
REPO=ZeroTierOne
|
2024-05-19 10:41:22 -04:00
|
|
|
DOCKER_IMAGE="xubiaolin/zerotier-planet"
|
|
|
|
|
2024-05-16 17:20:33 -04:00
|
|
|
|
|
|
|
latest_tag=$(curl -s "https://api.github.com/repos/$USER/$REPO/tags" | jq -r '.[].name' | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" | sort -V | tail -n 1)
|
2024-05-19 10:41:22 -04:00
|
|
|
latest_docker_tag=$(curl -s "https://hub.docker.com/v2/repositories/${DOCKER_IMAGE}/tags/" | jq -r '.results[].name' | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" | sort -V | tail -n 1)
|
2024-05-16 17:20:33 -04:00
|
|
|
|
2024-05-20 02:16:28 -04:00
|
|
|
if [ "$latest_tag" == "$latest_docker_tag" ]; then
|
|
|
|
echo "No new version found"
|
|
|
|
exit 0
|
|
|
|
fi
|
2024-05-16 17:20:33 -04:00
|
|
|
|
2024-05-19 10:41:22 -04:00
|
|
|
echo "Latest tag for $USER/$REPO matching latest is: $latest_tag"
|
2024-05-19 21:36:56 -04:00
|
|
|
docker buildx build --platform linux/arm64,linux/amd64 -t "$DOCKER_IMAGE":latest --push .
|
|
|
|
docker buildx build --platform linux/arm64,linux/amd64 -t "${DOCKER_IMAGE}:${latest_tag}" --push .
|