update.sh 525 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env bash
  2. set -e
  3. TAG="$(curl 'https://api.github.com/repos/kovidgoyal/calibre/releases?per_page=1' | jq -r '.[0].tag_name')"
  4. if [[ ! $TAG =~ ^v[0-9.]+$ ]]; then
  5. echo "skipping invalid tag: $TAG"
  6. exit 1
  7. fi
  8. sed -i "s/ARG CALIBRE_RELEASE\=.*/ARG CALIBRE_RELEASE\=\"${TAG:1}\"/" Dockerfile
  9. if git diff --exit-code Dockerfile; then
  10. echo "Dockerfile already on ${TAG}"
  11. exit 0
  12. fi
  13. git add Dockerfile
  14. git commit -m "update Calibre to ${TAG}"
  15. git tag -f "${TAG}"
  16. git push -f --tags
  17. git push origin main