vscodium/stores/snapcraft/check_version.sh

36 lines
878 B
Bash
Raw Normal View History

2021-12-17 17:21:31 -05:00
#!/bin/bash
set -e
2022-09-19 01:27:12 -04:00
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
2022-10-06 16:15:41 -04:00
SNAP_NAME="${APP_NAME}-insiders"
2021-12-17 17:21:31 -05:00
else
2022-10-06 16:15:41 -04:00
SNAP_NAME="${APP_NAME}"
2022-09-19 01:27:12 -04:00
fi
2022-08-29 09:13:25 -04:00
2022-09-19 01:27:12 -04:00
sudo snap install --channel stable --classic snapcraft
2022-09-19 01:27:12 -04:00
echo "Architecture: ${ARCHITECTURE}"
2022-09-19 01:27:12 -04:00
SNAP_VERSION=$(snapcraft list-revisions ${SNAP_NAME} | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4)
echo "Snap version: ${SNAP_VERSION}"
2021-12-17 17:21:31 -05:00
2022-10-06 16:15:41 -04:00
wget --quiet "https://api.github.com/repos/${ASSETS_REPOSITORY}/releases" -O gh_latest.json
2022-09-19 01:27:12 -04:00
GH_VERSION=$(jq -r 'sort_by(.tag_name)|last.tag_name' gh_latest.json)
echo "GH version: ${GH_VERSION}"
2021-12-17 17:21:31 -05:00
2022-09-19 01:27:12 -04:00
rm -f gh_latest.json
2022-09-19 01:27:12 -04:00
if [[ "${SNAP_VERSION}" == "${GH_VERSION}" ]]; then
export SHOULD_DEPLOY="no"
else
export SHOULD_DEPLOY="yes"
2022-03-04 09:08:21 -05:00
2022-09-19 01:27:12 -04:00
snap version
snap info "${SNAP_NAME}" | true
2021-12-17 17:21:31 -05:00
fi
if [[ "${GITHUB_ENV}" ]]; then
echo "SHOULD_DEPLOY=${SHOULD_DEPLOY}" >> "${GITHUB_ENV}"
2021-12-17 17:21:31 -05:00
fi