feat: automate winget release (#1260)

This commit is contained in:
Baptiste Augrain
2022-09-19 07:27:12 +02:00
committed by GitHub
parent a65ecfc37b
commit 03be08e721
8 changed files with 108 additions and 57 deletions

View File

@@ -2,46 +2,34 @@
set -e
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
echo "It's a PR"
export SHOULD_DEPLOY="no"
elif [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then
echo "It's a Push"
export SHOULD_DEPLOY="no"
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
REPOSITORY="${GITHUB_REPOSITORY:-"VSCodium/vscodium"}-insiders"
SNAP_NAME="codium-insiders"
else
echo "It's a cron"
REPOSITORY="${GITHUB_REPOSITORY:-"VSCodium/vscodium"}"
SNAP_NAME="codium"
fi
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
REPOSITORY="${GITHUB_REPOSITORY:-"VSCodium/vscodium"}-insiders"
SNAP_NAME="codium-insiders"
else
REPOSITORY="${GITHUB_REPOSITORY:-"VSCodium/vscodium"}"
SNAP_NAME="codium"
fi
sudo snap install --channel stable --classic snapcraft
sudo snap install --channel stable --classic snapcraft
echo "Architecture: ${ARCHITECTURE}"
echo "Architecture: ${ARCHITECTURE}"
SNAP_VERSION=$(snapcraft list-revisions ${SNAP_NAME} | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4)
echo "Snap version: ${SNAP_VERSION}"
SNAP_VERSION=$(snapcraft list-revisions ${SNAP_NAME} | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4)
echo "Snap version: ${SNAP_VERSION}"
wget --quiet "https://api.github.com/repos/${REPOSITORY}/releases" -O gh_latest.json
GH_VERSION=$(jq -r 'sort_by(.tag_name)|last.tag_name' gh_latest.json)
echo "GH version: ${GH_VERSION}"
wget --quiet "https://api.github.com/repos/${REPOSITORY}/releases" -O gh_latest.json
GH_VERSION=$(jq -r 'sort_by(.tag_name)|last.tag_name' gh_latest.json)
echo "GH version: ${GH_VERSION}"
rm -f gh_latest.json
rm -f gh_latest.json
if [[ "${SNAP_VERSION}" == "${GH_VERSION}" ]]; then
export SHOULD_DEPLOY="no"
else
export SHOULD_DEPLOY="yes"
if [[ "${SNAP_VERSION}" == "${GH_VERSION}" ]]; then
export SHOULD_DEPLOY="no"
else
export SHOULD_DEPLOY="yes"
snap version
snap info "${SNAP_NAME}" | true
fi
snap version
snap info "${SNAP_NAME}" | true
fi
if [[ "${GITHUB_ENV}" ]]; then