This repository was archived by the owner on Oct 12, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathprepare-release.sh
More file actions
executable file
·121 lines (93 loc) · 3.11 KB
/
Copy pathprepare-release.sh
File metadata and controls
executable file
·121 lines (93 loc) · 3.11 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash -e
MY_NAME=$(basename "$0")
TRUE_PATH=$(readlink "$0" || echo "$0")
MY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source common.sh
WORK_DIR="${MY_DIR}/prep"
ARTIFACTS_DIR="${WORK_DIR}"
ARTIFACT_ZIP="${1}"
XA_TAG_COMPONENT="${XA_UTILS_VERSION}"
function die()
{
echo "$@"
exit 1
}
function usage()
{
cat <<EOF
Usage: ${MY_NAME} ARTIFACT_ZIP
where
ARTIFACT_ZIP is a path to the artifact produced by the commit you want to release.
The file must be downloaded manually from the build artifacts area.
EOF
exit 0
}
function prepare()
{
echo Unpacking artifact ZIP
unzip "${ARTIFACT_ZIP}"
if [ ! -d "${ARTIFACTS_DIR}" ]; then
die Artifacts directory ${ARTIFACTS_DIR} does not exist
fi
local llvm_version=$(head -1 "${ARTIFACTS_DIR}/llvm-version.txt" | tr -d ' \t')
local tag_name="L_${llvm_version}-${XA_TAG_COMPONENT}"
echo "${tag_name}" >> "${ARTIFACTS_DIR}/version.txt"
echo New build for LLVM ${llvm_version} found
echo New tag name: ${tag_name}
git fetch -t
if git tag -l | grep "${tag_name}" > /dev/null 2>&1; then
die Tag ${tag_name} already exists, please choose a new one
fi
local dest_archive="${MY_DIR}/${DIST_PACKAGE_NAME_BASE}-${tag_name}.7z"
if [ -f "${dest_archive}" ]; then
rm "${dest_archive}"
fi
# Combined archive with all operating systems (kept for backwards compatibility).
(cd "${ARTIFACTS_DIR}"; 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on "${dest_archive}" .)
echo
echo Release archive: ${dest_archive}
echo
# Per-OS archives so consumers can download only the toolchain for their host.
# Each archive keeps the "<os>/" prefix and the shared version files so that the
# extracted layout matches the combined archive.
local os
local os_archive
for os in ${OPERATING_SYSTEMS}; do
if [ ! -d "${ARTIFACTS_DIR}/${os}" ]; then
die Operating system directory ${ARTIFACTS_DIR}/${os} does not exist
fi
os_archive="${MY_DIR}/${DIST_PACKAGE_NAME_BASE}-${os}-${tag_name}.7z"
if [ -f "${os_archive}" ]; then
rm "${os_archive}"
fi
(cd "${ARTIFACTS_DIR}"; 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on "${os_archive}" "${os}" llvm-version.txt version.txt)
echo
echo Release archive: ${os_archive}
echo
done
echo Setting variable 'LlvmVersion' to ${llvm_version}
echo "##vso[task.setvariable variable=LlvmVersion]${llvm_version}"
echo Setting variable 'GitTagValue' to ${tag_name}
echo "##vso[task.setvariable variable=GitTagValue]${tag_name}"
echo
cat <<EOF
Next steps:
* Go to https://github.com/dotnet/android-native-tools/releases
* Create new release using the '${tag_name}' tag
* Upload the following archives to that release:
- ${dest_archive}
$(for os in ${OPERATING_SYSTEMS}; do echo " - ${MY_DIR}/${DIST_PACKAGE_NAME_BASE}-${os}-${tag_name}.7z"; done)
EOF
}
if [ -z "${ARTIFACT_ZIP}" ]; then
usage
fi
if [ ! -f "${ARTIFACT_ZIP}" ]; then
die Artifact ZIP archive not found at ${ARTIFACT_ZIP}
fi
if [ -d "${WORK_DIR}" ]; then
rm -rf "${WORK_DIR}"
fi
install -d -m 755 "${WORK_DIR}"
ARTIFACT_ZIP="$(cd "$(dirname ${ARTIFACT_ZIP})"; pwd)/"$(basename ${ARTIFACT_ZIP})""
(cd "${WORK_DIR}"; prepare)