vscodium/stores/snapcraft/check_version.sh

44 lines
1.4 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# shellcheck disable=SC2129
2021-12-18 01:21:31 +03:00
set -e
2024-02-08 18:10:05 +03:00
export SHOULD_BUILD="no"
export SHOULD_DEPLOY_TO_RELEASE="no"
export SHOULD_DEPLOY_TO_STORE="no"
if [[ "${GENERATE_ASSETS}" == "true" ]]; then
2024-02-08 21:00:58 +03:00
export SHOULD_BUILD="yes"
else
wget --quiet "https://api.github.com/repos/${ASSETS_REPOSITORY}/releases" -O gh_latest.json
SNAP_URL=$( jq -r 'map(select(.tag_name == "'"${RELEASE_VERSION}"'"))|first.assets[].browser_download_url|select(endswith("'"_${ARCHITECTURE}.snap"'"))' gh_latest.json )
if [[ -z "${SNAP_URL}" ]]; then
export SHOULD_BUILD="yes"
export SHOULD_DEPLOY_TO_RELEASE="yes"
fi
2024-02-08 21:00:58 +03:00
if [[ "${VSCODE_QUALITY}" == "stable" ]]; then
sudo snap install --channel stable --classic snapcraft
2021-12-18 01:21:31 +03:00
echo "Architecture: ${ARCHITECTURE}"
2021-12-18 01:21:31 +03:00
SNAP_VERSION=$( snapcraft list-revisions "${SNAP_NAME}" | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4 )
echo "Snap version: ${SNAP_VERSION}"
if [[ "${SNAP_VERSION}" != "${RELEASE_VERSION}" ]]; then
export SHOULD_BUILD="yes"
export SHOULD_DEPLOY_TO_STORE="yes"
2022-03-04 17:08:21 +03:00
snap version
snap info "${SNAP_NAME}" || true
fi
2024-02-08 18:10:05 +03:00
fi
2021-12-18 01:21:31 +03:00
fi
if [[ "${GITHUB_ENV}" ]]; then
2024-02-08 18:10:05 +03:00
echo "SHOULD_BUILD=${SHOULD_BUILD}" >> "${GITHUB_ENV}"
echo "SHOULD_DEPLOY_TO_RELEASE=${SHOULD_DEPLOY_TO_RELEASE}" >> "${GITHUB_ENV}"
echo "SHOULD_DEPLOY_TO_STORE=${SHOULD_DEPLOY_TO_STORE}" >> "${GITHUB_ENV}"
2021-12-18 01:21:31 +03:00
fi