feat: build insider from saved commit or from the latest

This commit is contained in:
Baptiste Augrain 2022-08-22 15:10:00 +02:00
parent 3a0ac5f70e
commit 70e6f66c60
6 changed files with 78 additions and 61 deletions

54
build/build.sh Executable file
View file

@ -0,0 +1,54 @@
#!/bin/bash
### Windows
# to run with Bash: "C:\Program Files\Git\bin\bash.exe" ./build/build_windows.sh
###
export INSIDER="no"
export VSCODE_LATEST="no"
while getopts ":il" opt; do
case "$opt" in
i)
export INSIDER="yes"
;;
l)
export VSCODE_LATEST="yes"
;;
esac
done
case "$OSTYPE" in
darwin*)
export OS_NAME="osx"
;;
msys* | cygwin*)
export OS_NAME="windows"
;;
*)
export OS_NAME="linux"
;;
esac
UNAME_ARCH=$( uname -m )
if [[ "${UNAME_ARCH}" == "arm64" ]]; then
export VSCODE_ARCH="arm64"
else
export VSCODE_ARCH="x64"
fi
echo "OS_NAME: ${OS_NAME}"
echo "VSCODE_ARCH: ${VSCODE_ARCH}"
echo "VSCODE_LATEST: ${VSCODE_LATEST}"
echo "INSIDER: ${INSIDER}"
rm -rf vscode* VSCode*
if [[ "${OS_NAME}" == "windows" ]]; then
rm -rf build/windows/msi/releasedir
fi
. get_repo.sh
SHOULD_BUILD=yes CI_BUILD=no . build.sh

View file

@ -1,12 +0,0 @@
#!/bin/bash
rm -rf VSCode*
rm -rf vscode*
if [[ "${1}" == "insider" ]]; then
export INSIDER="yes"
fi
. get_repo.sh
SHOULD_BUILD=yes CI_BUILD=no OS_NAME=linux VSCODE_ARCH=x64 . build.sh

View file

@ -1,22 +0,0 @@
#!/bin/bash
rm -rf VSCode*
rm -rf vscode*
UNAME_ARCH=$( uname -m )
if [[ "${UNAME_ARCH}" == "arm64" ]]; then
export VSCODE_ARCH="arm64"
else
export VSCODE_ARCH="x64"
fi
echo "-- VSCODE_ARCH: ${VSCODE_ARCH}"
if [[ "${1}" == "insider" ]]; then
export INSIDER="yes"
fi
. get_repo.sh
SHOULD_BUILD=yes CI_BUILD=no OS_NAME=osx . build.sh

View file

@ -1,15 +0,0 @@
#!/bin/bash
# to run with Bash: "C:\Program Files\Git\bin\bash.exe" ./build/build_windows.sh
rm -rf VSCode*
rm -rf vscode*
rm -rf build/windows/msi/releasedir
if [[ "${1}" == "insider" ]]; then
export INSIDER="yes"
fi
. get_repo.sh
SHOULD_BUILD=yes CI_BUILD=no OS_NAME=windows VSCODE_ARCH=x64 . build.sh

View file

@ -8,18 +8,26 @@ if [[ "${CI_BUILD}" != "no" ]]; then
fi
if [[ -z "${RELEASE_VERSION}" ]]; then
if [ "${INSIDER}" == "yes" ]; then
UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/insider/lol)
if [[ "${INSIDER}" == "yes" ]]; then
if [[ "${VSCODE_LATEST}" == "yes" ]] || [[ ! -f "insider.json" ]]; then
UPDATE_INFO=$( curl https://update.code.visualstudio.com/api/update/darwin/insider/lol )
else
export MS_COMMIT=$(jq -r '.commit' insider.json)
export MS_TAG=$(jq -r '.tag' insider.json)
fi
else
UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/stable/lol)
UPDATE_INFO=$( curl https://update.code.visualstudio.com/api/update/darwin/stable/lol )
fi
if [[ -z "${MS_COMMIT}" ]]; then
export MS_COMMIT=$( echo "${UPDATE_INFO}" | jq -r '.version' )
export MS_TAG=$( echo "${UPDATE_INFO}" | jq -r '.name' )
fi
export MS_COMMIT=$(echo "${UPDATE_INFO}" | jq -r '.version')
export MS_TAG=$(echo "${UPDATE_INFO}" | jq -r '.name')
date=$( date +%Y%j )
if [ "${INSIDER}" == "yes" ]; then
export RELEASE_VERSION="${MS_TAG/-insider/}.${date: -5}-insider"
if [[ "${INSIDER}" == "yes" ]]; then
export RELEASE_VERSION="${MS_TAG/\-insider/}.${date: -5}-insider"
else
export RELEASE_VERSION="${MS_TAG}.${date: -5}"
fi
@ -43,13 +51,13 @@ git remote add origin https://github.com/Microsoft/vscode.git
# figure out latest tag by calling MS update API
if [[ -z "${MS_TAG}" ]]; then
if [ "${INSIDER}" == "yes" ]; then
UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/insider/lol)
if [[ "${INSIDER}" == "yes" ]]; then
UPDATE_INFO=$( curl https://update.code.visualstudio.com/api/update/darwin/insider/lol )
else
UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/stable/lol)
UPDATE_INFO=$( curl https://update.code.visualstudio.com/api/update/darwin/stable/lol )
fi
export MS_COMMIT=$(echo "${UPDATE_INFO}" | jq -r '.version')
export MS_TAG=$(echo "${UPDATE_INFO}" | jq -r '.name')
export MS_COMMIT=$( echo "${UPDATE_INFO}" | jq -r '.version' )
export MS_TAG=$( echo "${UPDATE_INFO}" | jq -r '.name' )
elif [[ -z "${MS_COMMIT}" ]]; then
reference=$( git ls-remote --tags | grep -x ".*refs\/tags\/${MS_TAG}" | head -1 )

4
insider.json Normal file
View file

@ -0,0 +1,4 @@
{
"tag": "1.71.0",
"commit": "8e42bda5487a953d59fab7792eedd4ca209cabba"
}