Skip to content

Commit

Permalink
Unify packaging scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Sep 5, 2023
1 parent dee994a commit 0a1d055
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 42 deletions.
20 changes: 1 addition & 19 deletions bump_deb_packaging
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
#!/bin/bash -e

. settings

REMOTE_BRANCH=deb/${FOREMAN_VERSION}

cd "$PACKAGING_DIR"

git fetch $PACKAGING_GIT_REMOTE
git checkout -b deb/release-$PROJECT-$FULLVERSION $PACKAGING_GIT_REMOTE/$REMOTE_BRANCH

scripts/changelog.rb -v ${FULLVERSION/-rc/~rc}-1 -m "$FULLVERSION released" debian/*/*/changelog
git add debian/*/*/changelog

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
./bump_packaging deb
38 changes: 38 additions & 0 deletions bump_packaging
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash -e

. settings

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"

cd "$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
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
24 changes: 1 addition & 23 deletions bump_rpm_packaging
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
#!/bin/bash -e

. settings

REMOTE_BRANCH=rpm/${FOREMAN_VERSION}

cd "$PACKAGING_DIR"

git fetch $PACKAGING_GIT_REMOTE
git checkout -b rpm/release-$PROJECT-$FULLVERSION $PACKAGING_GIT_REMOTE/$REMOTE_BRANCH

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 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
./bump_packaging rpm

0 comments on commit 0a1d055

Please sign in to comment.