check_deploy.sh 959 B

1234567891011121314151617181920212223242526272829303132333435
  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 curl -sS --unix-socket /run/snapd.socket http://localhost/v2/find\?q\=codium > snap_latest.json
  12. SNAP_VERSION=$(jq -r '.result|map(select(.id == "lIZWXTqmo6LFSts5Cgk2VPlNwtysZAeH"))|last.version' snap_latest.json)
  13. echo "Snap version: ${SNAP_VERSION}"
  14. wget --quiet https://api.github.com/repos/VSCodium/vscodium/releases -O gh_latest.json
  15. GH_VERSION=$(jq -r 'sort_by(.tag_name)|last.tag_name' gh_latest.json)
  16. echo "GH version: ${GH_VERSION}"
  17. rm -f snap_latest.json gh_latest.json
  18. if [[ "${SNAP_VERSION}" == "${GH_VERSION}" ]]; then
  19. export SHOULD_DEPLOY="no"
  20. else
  21. export SHOULD_DEPLOY="yes"
  22. fi
  23. fi
  24. if [[ $GITHUB_ENV ]]; then
  25. echo "SHOULD_DEPLOY=$SHOULD_DEPLOY" >> $GITHUB_ENV
  26. fi