-
Notifications
You must be signed in to change notification settings - Fork 16
/
bump_packaging
executable file
·59 lines (45 loc) · 1.55 KB
/
bump_packaging
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
#!/bin/bash -e
. settings
require_fullversion
FLAVOR=$1
if [[ $FLAVOR != deb ]] && [[ $FLAVOR != rpm ]] ; then
echo "Usage: $0 [deb|rpm]" >&2
exit 1
fi
REMOTE_BRANCH="${FLAVOR}/${FOREMAN_VERSION}"
FULL_REMOTE_BRANCH="$PACKAGING_GIT_REMOTE/$REMOTE_BRANCH"
if [[ $GIT_USE_WORKTREES == true ]] ; then
RELEASE_PACKAGING_DIR="${PACKAGING_DIR}/${FLAVOR}-$VERSION"
if [[ ! -d "$RELEASE_PACKAGING_DIR" ]] ; then
(
cd "${PACKAGING_DIR}/master"
git worktree add "$RELEASE_PACKAGING_DIR" "$PACKAGING_GIT_REMOTE/$REMOTE_BRANCH"
)
fi
else
RELEASE_PACKAGING_DIR="${PACKAGING_DIR}"
if [[ ! -d "$RELEASE_PACKAGING_DIR" ]] ; then
git clone --quiet --origin "$PACKAGING_GIT_REMOTE" https://github.com/theforeman/foreman-packaging "${RELEASE_PACKAGING_DIR}"
fi
fi
cd "$RELEASE_PACKAGING_DIR"
git fetch $PACKAGING_GIT_REMOTE
git checkout -b "${FLAVOR}/release-$PROJECT-$FULLVERSION" "${FULL_REMOTE_BRANCH}"
if [[ $FLAVOR == deb ]] ; then
scripts/changelog.rb -v "${FULLVERSION/-rc/~rc}-1" -m "$FULLVERSION released" debian/*/*/changelog
git add debian/*/*/changelog
else
if [[ $FULLVERSION == *-rc* ]]; then
PRERELEASE=${FULLVERSION##*-}
obal update --version "${FULLVERSION%%-rc*}" --prerelease "${PRERELEASE}" --release keep "${RPM_PACKAGES[@]}"
else
obal update --version "${FULLVERSION}" "${RPM_PACKAGES[@]}"
fi
git add "${RPM_PACKAGES[@]/#/packages\/${PROJECT}/}"
fi
git commit -m "Release $FULLVERSION"
if [[ $PACKAGING_PR == true ]] ; then
git phr -m "Release $FULLVERSION" -b "$REMOTE_BRANCH"
else
git push "$PACKAGING_GIT_REMOTE" "HEAD:$REMOTE_BRANCH"
fi