forked from voideditor/void-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_repo.sh
More file actions
executable file
·89 lines (70 loc) · 2.69 KB
/
get_repo.sh
File metadata and controls
executable file
·89 lines (70 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
# shellcheck disable=SC2129
set -e
# Echo all environment variables used by this script
echo "----------- get_repo -----------"
echo "Environment variables:"
echo "CI_BUILD=${CI_BUILD}"
echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}"
echo "RELEASE_VERSION=${RELEASE_VERSION}"
echo "VSCODE_LATEST=${VSCODE_LATEST}"
echo "VSCODE_QUALITY=${VSCODE_QUALITY}"
echo "GITHUB_ENV=${GITHUB_ENV}"
echo "SHOULD_DEPLOY=${SHOULD_DEPLOY}"
echo "SHOULD_BUILD=${SHOULD_BUILD}"
echo "-------------------------"
# git workaround
if [[ "${CI_BUILD}" != "no" ]]; then
git config --global --add safe.directory "/__w/$( echo "${GITHUB_REPOSITORY}" | awk '{print tolower($0)}' )"
fi
VOID_BRANCH="main"
echo "Cloning void ${VOID_BRANCH}..."
mkdir -p vscode
cd vscode || { echo "'vscode' dir not found"; exit 1; }
git init -q
git remote add origin https://github.com/voideditor/void.git
# Allow callers to specify a particular commit to checkout via the
# environment variable VOID_COMMIT. We still default to the tip of the
# ${VOID_BRANCH} branch when the variable is not provided. Keeping
# VOID_BRANCH as "main" ensures the rest of the script (and downstream
# consumers) behave exactly as before.
if [[ -n "${VOID_COMMIT}" ]]; then
echo "Using explicit commit ${VOID_COMMIT}"
# Fetch just that commit to keep the clone shallow.
git fetch --depth 1 origin "${VOID_COMMIT}"
git checkout "${VOID_COMMIT}"
else
git fetch --depth 1 origin "${VOID_BRANCH}"
git checkout FETCH_HEAD
fi
MS_TAG=$( jq -r '.version' "package.json" )
MS_COMMIT=$VOID_BRANCH # Void - MS_COMMIT doesn't seem to do much
VOID_VERSION=$( jq -r '.voidVersion' "product.json" ) # Void added this
if [[ -n "${VOID_RELEASE}" ]]; then # Void added VOID_RELEASE as optional to bump manually
RELEASE_VERSION="${MS_TAG}${VOID_RELEASE}"
else
VOID_RELEASE=$( jq -r '.voidRelease' "product.json" )
RELEASE_VERSION="${MS_TAG}${VOID_RELEASE}"
fi
# Void - RELEASE_VERSION is later used as version (1.0.3+RELEASE_VERSION), so it MUST be a number or it will throw a semver error in void
echo "RELEASE_VERSION=\"${RELEASE_VERSION}\""
echo "MS_COMMIT=\"${MS_COMMIT}\""
echo "MS_TAG=\"${MS_TAG}\""
cd ..
# for GH actions
if [[ "${GITHUB_ENV}" ]]; then
echo "MS_TAG=${MS_TAG}" >> "${GITHUB_ENV}"
echo "MS_COMMIT=${MS_COMMIT}" >> "${GITHUB_ENV}"
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_ENV}"
echo "VOID_VERSION=${VOID_VERSION}" >> "${GITHUB_ENV}" # Void added this
fi
echo "----------- get_repo exports -----------"
echo "MS_TAG ${MS_TAG}"
echo "MS_COMMIT ${MS_COMMIT}"
echo "RELEASE_VERSION ${RELEASE_VERSION}"
echo "VOID VERSION ${VOID_VERSION}"
echo "----------------------"
export MS_TAG
export MS_COMMIT
export RELEASE_VERSION
export VOID_VERSION