Skip to content

Commit

Permalink
prepare release 1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerdes committed Dec 10, 2024
1 parent 833172d commit 1088559
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Current Main

## Release 1.8.1

- attribute-completeness: indicator for `attribute-completeness` is now included in core profile ([#856])

[#856]: https://github.com/GIScience/ohsome-quality-api/issues/856
Expand Down
2 changes: 1 addition & 1 deletion ohsome_quality_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.8.0"
__version__ = "1.8.1"
__title__ = "ohsome quality API"
__description__ = "Data quality estimations for OpenStreetMap"
__author__ = "ohsome team"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ohsome_quality_api"
version = "1.8.0"
version = "1.8.1"
description = "Data quality estimations for OpenStreetMap."
authors = ["ohsome team <[email protected]>"]
homepage = "https://api.quality.ohsome.org"
Expand Down
32 changes: 32 additions & 0 deletions scripts/prompt_user_exit_or_continue.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# donation by mcauer as used in the 'ohsome-dashboard' project

prompt_user() {
local question="$1" # Capture the first argument as the question
while true; do
read -p "$question (y/n): " choice
case "$choice" in
y|Y )
echo "You chose Yes."
return 0 # Exit the function and proceed
;;
n|N )
echo "You chose No. Exiting."
exit 0 # Exit the script
;;
* )
echo "Invalid input. Please enter 'y' or 'n'."
;;
esac
done
}

# Example usage
#prompt_user "Do you want to continue?"

# import in other script

## Get the directory of the current script
#SCRIPT_DIR="$(dirname "$0")"
#
## import user prompt
#source "$SCRIPT_DIR/prompt_user_exit_or_continue.sh"
111 changes: 111 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# based on docs here: https://heigit.atlassian.net/wiki/spaces/OQT/pages/3474149/Releases
# requires local installation of `gh`, the github CLI: https://cli.github.com



# please adjust these version names first
export OLD_VERSION=1.8.0
export NEW_VERSION=1.8.1


# exit immediately if a command exits with a non-zero status
set -ex


# get the directory of the current script
SCRIPT_DIR="$(dirname "$0")"

# import user prompt
source "$SCRIPT_DIR/prompt_user_exit_or_continue.sh"


prompt_user "πŸ‘‰ did you adjust the values for old and new versions in the release script?"


prompt_user "πŸ‘‰ do you run this script in an active python env? if not run 'poetry shell' first"


# change to main directory
cd ..


# get latest version of main and create new branch
prompt_user "πŸ‘‰ create release branch?"
git checkout main
git pull
git checkout -b "release-$NEW_VERSION"
echo "βœ… created release branch of the latest main"


# update to latest version of swagger libs
prompt_user "πŸ‘‰ update swagger?"
./scripts/update_swagger_scripts.sh
echo "βœ… updated to latest version of swagger libs"


# Update version in pyproject.toml
prompt_user "πŸ‘‰ update project version?"
poetry version "$NEW_VERSION"
echo "βœ… updated project version in pyproject.toml to $NEW_VERSION"


# update version in __init__.py
prompt_user "πŸ‘‰ update __init__.py?"
export OLD="__version__ = \"$OLD_VERSION\""
export NEW="__version__ = \"$NEW_VERSION\""


# might not work like this on linux
sed -i .bak "s/$OLD/$NEW/g" ohsome_quality_api/__init__.py
rm -rf ohsome_quality_api/__init__.py.bak
echo "βœ… updated __init__.py to $NEW_VERSION"


# insert new sub-headline for new release
prompt_user "πŸ‘‰ update CHANGELOG.md?"
sed -i .bak "s/## Current Main/## Current Main \n\n## Release $NEW_VERSION/g" CHANGELOG.md
rm -rf CHANGELOG.md.bak
echo "βœ… updated CHANGELOG.md"


prompt_user "πŸ‘‰ commit and push all changed files?"
git add pyproject.toml
git add ohsome_quality_api/__init__.py
git add tests/integrationtests/fixtures/vcr_cassettes/*
git add CHANGELOG.md
git add scripts/release.sh
git add ohsome_quality_api/api/static/*

git commit -m "prepare release $NEW_VERSION"
git push --set-upstream origin "release-$NEW_VERSION"
echo "βœ… committed and pushed all changed files"


# create PR
prompt_user "πŸ‘‰ create PR?"
gh pr create --title "release new version $NEW_VERSION" --body "This PR is used for the Oqapi release process."
echo "βœ… created new PR for the release"


# get PR approved
prompt_user "⚠️ Please check swagger docs and have PR approved - hit <y> when ready!"


prompt_user "πŸ‘‰ merge approved PR?"
gh pr merge --rebase
echo "βœ… rebased the release PR into main"


git checkout main
git pull


# create github release and corresponding tag
prompt_user "πŸ‘‰ create github release and tag?"
export ANCHOR="release--${NEW_VERSION//\./}"
gh release create "$NEW_VERSION" -t "$NEW_VERSION" -n "See the [changelog](https://github.com/GIScience/ohsome-quality-api/blob/main/CHANGELOG.md#$ANCHOR) for release details."
echo "βœ… created new github release and tag for version: $NEW_VERSION"



echo "⚠️ Please start the Jenkins tag build here: https://jenkins.heigit.org/job/OQAPI/view/tags/job/$NEW_VERSION/"

0 comments on commit 1088559

Please sign in to comment.