check_version.sh 992 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. set -e
  3. if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
  4. echo "It's a PR"
  5. export SHOULD_DEPLOY="no"
  6. elif [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then
  7. echo "It's a Push"
  8. export SHOULD_DEPLOY="no"
  9. else
  10. echo "It's a cron"
  11. sudo snap install --channel stable --classic snapcraft
  12. echo "Architecture: ${ARCHITECTURE}"
  13. SNAP_VERSION=$(snapcraft list-revisions codium | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4)
  14. echo "Snap version: ${SNAP_VERSION}"
  15. wget --quiet https://api.github.com/repos/VSCodium/vscodium/releases -O gh_latest.json
  16. GH_VERSION=$(jq -r 'sort_by(.tag_name)|last.tag_name' gh_latest.json)
  17. echo "GH version: ${GH_VERSION}"
  18. rm -f gh_latest.json
  19. if [[ "${SNAP_VERSION}" == "${GH_VERSION}" ]]; then
  20. export SHOULD_DEPLOY="no"
  21. else
  22. export SHOULD_DEPLOY="yes"
  23. snap version
  24. snap info codium
  25. fi
  26. fi
  27. if [[ "${GITHUB_ENV}" ]]; then
  28. echo "SHOULD_DEPLOY=${SHOULD_DEPLOY}" >> "${GITHUB_ENV}"
  29. fi