Skip to content

Commit

Permalink
Fix release.sh to generate good releases
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Mar 25, 2021
1 parent 0c0ce48 commit 84195b5
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ LAST_TAG=$(git describe --tags --abbrev=0)
write_go_version()
{
LOCAL_VERSION="$1"
sed -i "s/^\(.*Version = \"\).*/\1${LOCAL_VERSION}\"/" buildah.go
sed -i "s/^\(.*Version = \"\).*/\1${LOCAL_VERSION}\"/" define/types.go
}

write_spec_version()
Expand All @@ -27,6 +27,22 @@ write_spec_version()
sed -i "s/^\(Version: *\).*/\1${LOCAL_VERSION}/" contrib/rpm/buildah.spec
}

write_spec_changelog()
{
sed '/\*.*-dev-1/d' -i ./contrib/rpm/buildah.spec
VERSION=$1
date=$(date "+%a %b %d, %Y")
name=$(getent passwd $USERNAME | cut -d ':' -f 5)
echo "* ${date} ${name} <${USER}@redhat.com> ${VERSION}-1" >.changelog.txt
if [[ "${VERSION}" != *-dev ]]; then
git log --no-merges --format='- %s' "${LAST_TAG}..HEAD" >>.changelog.txt
else
echo "" >>.changelog.txt
fi
sed '/^%changelog.*/r .changelog.txt' -i ./contrib/rpm/buildah.spec
rm -f .changelog.txt
}

write_makefile_epoch()
{
LOCAL_EPOCH="$1"
Expand All @@ -46,14 +62,16 @@ release_commit()
{
write_go_version "${VERSION}" &&
write_spec_version "${VERSION}" &&
write_spec_changelog "${VERSION}" &&
write_changelog &&
git commit -asm "Bump to v${VERSION}"
}

dev_version_commit()
{
write_go_version "${NEXT_VERSION}-dev" &&
write_spec_version "${NEXT_VERSION}" &&
write_spec_version "${NEXT_VERSION}-dev" &&
write_spec_changelog "${NEXT_VERSION}-dev" &&
git commit -asm "Bump to v${NEXT_VERSION}-dev"
}

Expand Down

0 comments on commit 84195b5

Please sign in to comment.