-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathentrypoint.sh
executable file
·85 lines (69 loc) · 2.09 KB
/
entrypoint.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
78
79
80
81
82
83
84
85
#!/bin/bash
cd "${GITHUB_WORKSPACE}" \
|| (echo "Workspace is unavailable" >&2; exit 1)
set -eu
# Setup
mkdir -p ~/.config
echo "{\"github_user\": \"${INPUT_GITHUB_USER}\", \"oauth_token\": \"${INPUT_GITHUB_TOKEN_BLOOM}\"}" > ~/.config/bloom
echo -e "machine github.com\nlogin ${INPUT_GITHUB_TOKEN_BLOOM}" > ~/.netrc
git config --global user.name ${INPUT_GIT_USER:-${INPUT_GITHUB_USER}}
git config --global user.email ${INPUT_GIT_EMAIL}
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
if [ "${INPUT_TAG_AND_RELEASE}" == "true" ]
then
manifest=$(find . -name package.xml | head -n1)
version=$(sed -e ':l;N;$!b l;s/\n/ /g;s|^.*<version>\(.*\)</version>.*|\1|' ${manifest})
if ! git ls-remote --exit-code origin ${version}
then
echo "Tag ${version} not found. Adding..."
git tag ${version}
git push origin ${version}
echo "version=${version}" >> ${GITHUB_OUTPUT}
else
echo "Tag ${version} found. Nothing to do."
exit 0
fi
fi
pkgname=${INPUT_REPOSITORY:-$(basename ${GITHUB_REPOSITORY})}
if [ $(find . -name package.xml | wc -l) -eq 1 ]
then
manifest=$(find . -name package.xml | head -n1)
pkgname=$(sed -e ':l;N;$!b l;s/\n/ /g;s|^.*<name>\(.*\)</name>.*|\1|' ${manifest})
fi
echo
echo "Package name: ${pkgname}"
echo
# Initialize
rosdep update
# Prepare bloom-release
options=
if [ ! -z "${INPUT_RELEASE_REPOSITORY_PUSH_URL:-}" ]
then
options="${options} --override-release-repository-push-url ${INPUT_RELEASE_REPOSITORY_PUSH_URL}"
fi
if [ "${INPUT_OPEN_PR:-false}" != "true" ]
then
options="${options} --no-pull-request"
fi
if [ "${INPUT_DEBUG_BLOOM:-false}" != "true" ]
then
options="${options} --debug"
fi
export TERM=dumb
for ros_distro in ${INPUT_ROS_DISTRO}
do
if ! (rosdep resolve ${pkgname} --rosdistro=${ros_distro} 2>&1 | grep ubuntu > /dev/null)
then
echo
echo "${pkgname} is not released to ${ros_distro} yet."
echo "Initial release should be done by hand."
echo
continue
fi
bloom-release \
-y \
--no-web \
--ros-distro ${ros_distro} \
${options} \
${INPUT_REPOSITORY:-$(basename ${GITHUB_REPOSITORY})}
done