build: specify vscode version to build (#807)

This commit is contained in:
Baptiste Augrain
2021-08-27 16:01:17 +02:00
committed by GitHub
parent a5506b975c
commit 96332714ae
7 changed files with 65 additions and 51 deletions

View File

@@ -1,26 +1,40 @@
#!/bin/bash
mkdir -p vscode
cd vscode
git init -q
git remote add origin https://github.com/Microsoft/vscode.git
# figure out latest tag by calling MS update API
if [ "$INSIDER" == "1" ]; then
UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/insider/lol)
else
export MS_COMMIT=$(echo $UPDATE_INFO | jq -r '.version')
export MS_TAG=$(echo $UPDATE_INFO | jq -r '.name')
elif [[ -z "${MS_TAG}" ]]; then
UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/stable/lol)
fi
export LATEST_MS_COMMIT=$(echo $UPDATE_INFO | jq -r '.version')
export LATEST_MS_TAG=$(echo $UPDATE_INFO | jq -r '.name')
echo "Got the latest MS tag: ${LATEST_MS_TAG} version: ${LATEST_MS_COMMIT}"
if [ "$INSIDER" == "1" ]; then
mkdir -p vscode; cd vscode
git init ; git remote add origin https://github.com/Microsoft/vscode.git
git fetch --depth 1 origin $LATEST_MS_COMMIT; git checkout FETCH_HEAD
cd ..
export MS_COMMIT=$(echo $UPDATE_INFO | jq -r '.version')
export MS_TAG=$(echo $UPDATE_INFO | jq -r '.name')
else
git clone https://github.com/Microsoft/vscode.git --branch $LATEST_MS_TAG --depth 1
tag_line=$( git ls-remote --tags --sort=-version:refname | grep "refs\/tags\/${MS_TAG}" | head -1 )
[[ "${tag_line}" =~ ^([[:alnum:]]+)[[:space:]]+refs\/tags\/([0-9]+\.[0-9]+\.[0-9]+)$ ]]
export MS_COMMIT="${BASH_REMATCH[1]}"
fi
echo "Got the MS tag: ${MS_TAG} version: ${MS_COMMIT}"
git fetch --depth 1 origin $MS_COMMIT
git checkout FETCH_HEAD
cd ..
# for GH actions
if [[ $GITHUB_ENV ]]; then
echo "LATEST_MS_COMMIT=$LATEST_MS_COMMIT" >> $GITHUB_ENV
echo "LATEST_MS_TAG=$LATEST_MS_TAG" >> $GITHUB_ENV
if [[ -z "${MS_TAG}" ]]; then
echo "MS_TAG=$MS_TAG" >> $GITHUB_ENV
fi
echo "MS_COMMIT=$MS_COMMIT" >> $GITHUB_ENV
fi