2023-07-21 17:45:07 +03:00
|
|
|
#!/usr/bin/env bash
|
2024-02-25 19:34:30 +03:00
|
|
|
# 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"
|
2021-12-18 05:09:27 +03:00
|
|
|
|
2024-02-25 19:34:30 +03:00
|
|
|
if [[ "${GENERATE_ASSETS}" == "true" ]]; then
|
2024-02-08 21:00:58 +03:00
|
|
|
export SHOULD_BUILD="yes"
|
2024-02-25 19:34:30 +03:00
|
|
|
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
|
|
|
|
2024-02-25 19:34:30 +03:00
|
|
|
if [[ "${VSCODE_QUALITY}" == "stable" ]]; then
|
|
|
|
sudo snap install --channel stable --classic snapcraft
|
2021-12-18 01:21:31 +03:00
|
|
|
|
2024-02-25 19:34:30 +03:00
|
|
|
echo "Architecture: ${ARCHITECTURE}"
|
2021-12-18 01:21:31 +03:00
|
|
|
|
2024-02-25 19:34:30 +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}"
|
2021-12-18 03:24:22 +03:00
|
|
|
|
2024-02-25 19:34:30 +03:00
|
|
|
if [[ "${SNAP_VERSION}" != "${RELEASE_VERSION}" ]]; then
|
|
|
|
export SHOULD_BUILD="yes"
|
|
|
|
export SHOULD_DEPLOY_TO_STORE="yes"
|
2022-03-04 17:08:21 +03:00
|
|
|
|
2024-02-25 19:34:30 +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
|
|
|
|
|
2022-06-05 22:30:23 +03:00
|
|
|
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
|