Skip to content

Commit

Permalink
Handle release candidates in release scripts
Browse files Browse the repository at this point in the history
Refs: #183
  • Loading branch information
orontee committed Sep 14, 2024
1 parent 89f3079 commit 433c7cc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 18 deletions.
9 changes: 7 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ First, update project version with::
Review, complete or update the suggested changes carefully; Make sure
translations and screenshots are up-to-date. Commit, tag and push with::

$ git commit -a -m "Update to version $(poetry version | cut -d' ' -f 2)"
$ git tag $(poetry version | cut -d' ' -f 2)
$ git commit -a -m "Update to version $(poetry version --short)"
$ git tag $(poetry version --short)
$ git push origin; git push --tags origin

Use ``flatpak-builder`` to build locally and Github actions to build a
Expand All @@ -143,6 +143,11 @@ Make a pull request to the technical repository
<https://github.com/flathub/io.github.orontee.Argos>`_ to publish the
release through Flathub.

Finally, run the following command to commit version bump for next
release::

$ poetry run ./scripts/prepare-next-release

Architecture
============

Expand Down
50 changes: 46 additions & 4 deletions scripts/prepare-next-release
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

NEWS_HEADER="[Unreleased]\n============\n\nAdded\n-----\n\nChanged\n-------\n\nRemoved\n-------\n"

cd "${MESON_SOURCE_ROOT}"

if [[ -n "$(git status --porcelain)" ]]; then
Expand All @@ -14,6 +12,50 @@ if [[ $(git rev-parse --abbrev-ref HEAD) != "main" ]]; then
exit 1
fi

sed -i "11 i ${NEWS_HEADER}" NEWS.rst
git add NEWS.rst
NEW_VERSION=$(poetry version --short preminor)
git add pyproject.toml
echo "Version set to ${NEW_VERSION}"

NEWS_HEADER="[Unreleased]\n============\n\nAdded\n-----\n\nChanged\n-------\n\nRemoved\n-------\n"

CHANGELOG_DATE=$(LANG=C date +"%a, %d %b %Y %H:%M:%S %z")
CHANGELOG_AUTHOR="$(git config user.name) <$(git config user.email)>"
CHANGELOG="argos (${NEW_VERSION}) UNRELEASED; urgency=medium
* ${NEW_VERSION} release.
-- ${CHANGELOG_AUTHOR} ${CHANGELOG_DATE}
"

update_news_file() {
local file_path="NEWS.rst"

echo "Updating ${file_path}..."
sed -i "11 i ${NEWS_HEADER}" ${file_path}

git add ${file_path}
}

update_debian_changelog() {
local file_path="debian/changelog"

echo "Updating ${file_path}..."
echo "$(echo "${CHANGELOG}"; cat ${file_path})" > ${file_path}

git add ${file_path}
}

update_meson_conf() {
local file_path="meson.build"

echo "Updating ${file_path}..."
sed -i "s/version: '${CURRENT_VERSION}'/version: '${NEW_VERSION}'/" ${file_path}

git add ${file_path}
}

update_news_file
update_debian_changelog
update_meson_conf

git commit -m "Prepare for next release"
16 changes: 4 additions & 12 deletions scripts/update-version
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

cd "${MESON_SOURCE_ROOT}"

CURRENT_VERSION=$(poetry version | cut -d' ' -f 2)
CURRENT_VERSION=$(poetry version --short)

NEW_VERSION=$(python -c "import semver; print(semver.VersionInfo.parse(\"${CURRENT_VERSION}\").bump_minor())")
NEW_VERSION=$(poetry version --short minor)

CHANGELOG_DATE=$(LANG=C date +"%a, %d %b %Y %H:%M:%S %z")
CHANGELOG_AUTHOR="$(git config user.name) <$(git config user.email)>"
Expand Down Expand Up @@ -39,7 +39,7 @@ update_readme_file() {
local file_path="README.rst"

echo "Updating ${file_path}..."
sed -i "s/VERSION=${CURRENT_VERSION}/VERSION=${NEW_VERSION}/" ${file_path}
sed -i "s/VERSION=.*/VERSION=${NEW_VERSION}/" ${file_path}
}

update_appdata_file() {
Expand All @@ -53,7 +53,7 @@ update_debian_changelog() {
local file_path="debian/changelog"

echo "Updating ${file_path}..."
echo "$(echo "${CHANGELOG}"; cat ${file_path})" > ${file_path}
sed -i "s/${CURRENT_VERSION}/${NEW_VERSION}/" ${file_path}
}

update_meson_conf() {
Expand All @@ -63,16 +63,8 @@ update_meson_conf() {
sed -i "s/version: '${CURRENT_VERSION}'/version: '${NEW_VERSION}'/" ${file_path}
}

update_project_conf() {
local file_path="pyproject.toml"

echo "Updating ${file_path}..."
sed -i "s/version = .*/version = \"$NEW_VERSION\"/" ${file_path}
}

update_readme_file
update_meson_conf
update_project_conf
update_news_file
update_appdata_file
update_debian_changelog
Expand Down

0 comments on commit 433c7cc

Please sign in to comment.