check_version.sh 893 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env bash
  2. set -e
  3. if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
  4. SNAP_NAME="${APP_NAME}-insiders"
  5. else
  6. SNAP_NAME="${APP_NAME}"
  7. fi
  8. sudo snap install --channel stable --classic snapcraft
  9. echo "Architecture: ${ARCHITECTURE}"
  10. SNAP_VERSION=$( snapcraft list-revisions "${SNAP_NAME}" | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4 )
  11. echo "Snap version: ${SNAP_VERSION}"
  12. wget --quiet "https://api.github.com/repos/${ASSETS_REPOSITORY}/releases" -O gh_latest.json
  13. GH_VERSION=$( jq -r 'sort_by(.tag_name)|last.tag_name' gh_latest.json )
  14. echo "GH version: ${GH_VERSION}"
  15. rm -f gh_latest.json
  16. if [[ "${SNAP_VERSION}" == "${GH_VERSION}" ]]; then
  17. export SHOULD_DEPLOY="no"
  18. else
  19. export SHOULD_DEPLOY="yes"
  20. snap version
  21. snap info "${SNAP_NAME}" || true
  22. fi
  23. if [[ "${GITHUB_ENV}" ]]; then
  24. echo "SHOULD_DEPLOY=${SHOULD_DEPLOY}" >> "${GITHUB_ENV}"
  25. fi