2023-07-21 10:45:07 -04:00
|
|
|
#!/usr/bin/env bash
|
2024-02-25 11:34:30 -05:00
|
|
|
# shellcheck disable=SC2129
|
2021-12-17 17:21:31 -05:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-02-08 10:10:05 -05:00
|
|
|
export SHOULD_BUILD="no"
|
|
|
|
export SHOULD_DEPLOY_TO_RELEASE="no"
|
|
|
|
export SHOULD_DEPLOY_TO_STORE="no"
|
2021-12-17 21:09:27 -05:00
|
|
|
|
2024-02-25 11:34:30 -05:00
|
|
|
if [[ "${GENERATE_ASSETS}" == "true" ]]; then
|
2024-02-08 13:00:58 -05:00
|
|
|
export SHOULD_BUILD="yes"
|
2024-02-25 11:34:30 -05: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 13:00:58 -05:00
|
|
|
|
2024-02-25 11:34:30 -05:00
|
|
|
if [[ "${VSCODE_QUALITY}" == "stable" ]]; then
|
|
|
|
sudo snap install --channel stable --classic snapcraft
|
2021-12-17 17:21:31 -05:00
|
|
|
|
2024-02-25 11:34:30 -05:00
|
|
|
echo "Architecture: ${ARCHITECTURE}"
|
2021-12-17 17:21:31 -05:00
|
|
|
|
2024-02-25 11:34:30 -05: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 19:24:22 -05:00
|
|
|
|
2024-02-25 11:34:30 -05:00
|
|
|
if [[ "${SNAP_VERSION}" != "${RELEASE_VERSION}" ]]; then
|
|
|
|
export SHOULD_BUILD="yes"
|
|
|
|
export SHOULD_DEPLOY_TO_STORE="yes"
|
2022-03-04 09:08:21 -05:00
|
|
|
|
2024-02-25 11:34:30 -05:00
|
|
|
snap version
|
|
|
|
snap info "${SNAP_NAME}" || true
|
|
|
|
fi
|
2024-02-08 10:10:05 -05:00
|
|
|
fi
|
2021-12-17 17:21:31 -05:00
|
|
|
fi
|
|
|
|
|
2022-06-05 15:30:23 -04:00
|
|
|
if [[ "${GITHUB_ENV}" ]]; then
|
2024-02-08 10:10:05 -05: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-17 17:21:31 -05:00
|
|
|
fi
|