forked from tier4/AutowareArchitectureProposal.proj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release_candidate.sh
executable file
·38 lines (30 loc) · 1012 Bytes
/
release_candidate.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
#!/usr/bin/env bash
# Parameter
export repos_file="autoware.proj.repos"
export use_commit_description=true
# Install prerequisites
export PATH=/snap/bin:$PATH
if !(command -v yq > /dev/null 2>&1); then
sudo snap install yq
fi
# Update repositories
vcs import src < "$repos_file"
if [ $? -ne 0 ]; then
echo -e "\n\e[31mFailed to execute 'vcs import'.\e[m"
exit 1
fi
vcs pull src
# Replace versions in .repos file
export repositories="$(yq r "$repos_file" repositories | ag "^[a-zA-Z]+" | sed "s/://g")"
for repository in $repositories; do
export repo_path="src/$repository"
export git_command="git --work-tree=$repo_path --git-dir=$repo_path/.git"
export commit_hash=$($git_command rev-parse HEAD)
if [ "$repository" == "autoware/autoware.iv" ] || [ "$repository" == "autoware/launcher" ]; then
export new_version=$1
else
export new_version=$commit_hash
fi
echo "$repository: $new_version"
yq w --inplace "$repos_file" "repositories.[$repository].version" "$new_version"
done