-
Notifications
You must be signed in to change notification settings - Fork 2
/
get_repo.sh
executable file
·77 lines (59 loc) · 1.74 KB
/
get_repo.sh
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
#!/bin/bash
if [ -d vscodium ];
then
cd vscodium
git fetch --all
else
git clone https://github.com/VSCodium/vscodium.git
cd vscodium
fi
if [[ -z "${RELEASE_VERSION}" ]]; then
VSCODIUM_RELEASE=$( git tag -l --sort=-version:refname | head -1 )
if [[ "${VSCODIUM_RELEASE}" =~ ^([0-9]+\.[0-9]+\.[0-9]+)\.[0-9]+$ ]];
then
MS_TAG="${BASH_REMATCH[1]}"
else
echo "Bad VSCODIUM_RELEASE: $VSCODIUM_RELEASE"
exit 1
fi
DATE=$( date +%Y%j )
export RELEASE_VERSION="$MS_TAG.${DATE: -5}"
else
if [[ "${RELEASE_VERSION}" =~ ^([0-9]+\.[0-9]+\.[0-9]+)\.[0-9]+$ ]];
then
MS_TAG="${BASH_REMATCH[1]}"
else
echo "Bad RELEASE_VERSION: $RELEASE_VERSION"
exit 1
fi
fi
# for GH actions
if [[ $GITHUB_ENV ]]; then
echo "MS_TAG=$MS_TAG" >> $GITHUB_ENV
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
fi
echo "Release version: ${RELEASE_VERSION}"
if [[ ! -z "${VSCODIUM_LATEST}" ]]; then
git pull origin master
VSCODIUM_COMMIT=$( git log --format="%H" -n 1 )
# for GH actions
if [[ $GITHUB_ENV ]]; then
echo "VSCODIUM_COMMIT=$VSCODIUM_COMMIT" >> $GITHUB_ENV
fi
fi
if [[ -z "${VSCODIUM_COMMIT}" ]]; then
echo "Using VSCode tag: ${MS_TAG}"
VSCODIUM_RELEASE=$( git tag -l --sort=-version:refname | grep "${MS_TAG}" | head -1 )
echo "Found VSCodium tag: ${VSCODIUM_RELEASE}"
git checkout $VSCODIUM_RELEASE
else
echo "Using VSCodium commit: ${VSCODIUM_COMMIT}"
git checkout $VSCODIUM_COMMIT
fi
cd ..
# for GH actions
if [[ "${GITHUB_ENV}" ]]; then
echo "MS_TAG=${MS_TAG}" >> "${GITHUB_ENV}"
echo "VSCODIUM_COMMIT=${VSCODIUM_COMMIT}" >> "${GITHUB_ENV}"
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_ENV}"
fi