diff --git a/.gitignore b/.gitignore index b77974e..ebf00a2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ VS*/* VSCode* VSCodium* .DS_Store +*.env artifacts/ build/linux/appimage/out build/linux/appimage/pkg2appimage.AppDir diff --git a/build.sh b/build.sh index a53fe61..7f9950c 100755 --- a/build.sh +++ b/build.sh @@ -6,7 +6,7 @@ if [[ "${SHOULD_BUILD}" == "yes" ]]; then npm config set scripts-prepend-node-path true npm config set node_gyp - echo "MS_COMMIT: ${MS_COMMIT}" + echo "MS_COMMIT=\"${MS_COMMIT}\"" . prepare_vscode.sh diff --git a/build/build.sh b/build/build.sh index 84efc79..60cce2b 100755 --- a/build/build.sh +++ b/build/build.sh @@ -6,11 +6,12 @@ export CI_BUILD="no" export SHOULD_BUILD="yes" +export SKIP_BUILD="no" export SKIP_PACKAGES="yes" export VSCODE_LATEST="no" export VSCODE_QUALITY="stable" -while getopts ":ilp" opt; do +while getopts ":ilop" opt; do case "$opt" in i) export VSCODE_QUALITY="insider" @@ -18,6 +19,9 @@ while getopts ":ilp" opt; do l) export VSCODE_LATEST="yes" ;; + o) + export SKIP_BUILD="yes" + ;; p) export SKIP_PACKAGES="no" ;; @@ -45,18 +49,35 @@ else fi echo "OS_NAME=\"${OS_NAME}\"" +echo "SKIP_BUILD=\"${SKIP_BUILD}\"" echo "SKIP_PACKAGES=\"${SKIP_PACKAGES}\"" echo "VSCODE_ARCH=\"${VSCODE_ARCH}\"" echo "VSCODE_LATEST=\"${VSCODE_LATEST}\"" echo "VSCODE_QUALITY=\"${VSCODE_QUALITY}\"" -rm -rf vscode* VSCode* +if [[ "${SKIP_BUILD}" == "no" ]]; then + rm -rf vscode* VSCode* -. get_repo.sh -. build.sh + . get_repo.sh -if [[ "${VSCODE_QUALITY}" == "insider" && "${VSCODE_LATEST}" == "yes" ]]; then - echo "$( cat "insider.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' )" > "insider.json" + # save variables for later + echo "MS_TAG=\"${MS_TAG}\"" > build.env + echo "MS_COMMIT=\"${MS_COMMIT}\"" >> build.env + echo "RELEASE_VERSION=\"${RELEASE_VERSION}\"" >> build.env + echo "BUILD_SOURCEVERSION=\"${BUILD_SOURCEVERSION}\"" >> build.env + + . build.sh + + if [[ "${VSCODE_QUALITY}" == "insider" && "${VSCODE_LATEST}" == "yes" ]]; then + echo "$( cat "insider.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' )" > "insider.json" + fi +else + . build.env + + echo "MS_TAG=\"${MS_TAG}\"" + echo "MS_COMMIT=\"${MS_COMMIT}\"" + echo "RELEASE_VERSION=\"${RELEASE_VERSION}\"" + echo "BUILD_SOURCEVERSION=\"${BUILD_SOURCEVERSION}\"" fi if [[ "${SKIP_PACKAGES}" == "no" ]]; then diff --git a/get_repo.sh b/get_repo.sh index bbf03ac..d63dbd2 100755 --- a/get_repo.sh +++ b/get_repo.sh @@ -80,16 +80,16 @@ if [[ -z "${MS_TAG}" ]]; then 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 ) + REFERENCE=$( git ls-remote --tags | grep -x ".*refs\/tags\/${MS_TAG}" | head -1 ) - if [[ -z "${reference}" ]]; then + if [[ -z "${REFERENCE}" ]]; then echo "The following tag can't be found: ${MS_TAG}" exit 1 - elif [[ "${reference}" =~ ^([[:alnum:]]+)[[:space:]]+refs\/tags\/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + elif [[ "${REFERENCE}" =~ ^([[:alnum:]]+)[[:space:]]+refs\/tags\/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then export MS_COMMIT="${BASH_REMATCH[1]}" export MS_TAG="${BASH_REMATCH[2]}" else - echo "The following reference can't be parsed: ${reference}" + echo "The following reference can't be parsed: ${REFERENCE}" exit 1 fi fi diff --git a/version.sh b/version.sh index 59ca17d..ff54587 100755 --- a/version.sh +++ b/version.sh @@ -16,7 +16,7 @@ if [[ -z "${BUILD_SOURCEVERSION}" ]]; then export BUILD_SOURCEVERSION=$( echo "${vscodium_hash}:${vscode_hash}" | checksum ) fi - echo "Build version: ${BUILD_SOURCEVERSION}" + echo "BUILD_SOURCEVERSION=\"${BUILD_SOURCEVERSION}\"" # for GH actions if [[ $GITHUB_ENV ]]; then