From 962220a6907b2ed804dc6645175f29099e57dac4 Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Wed, 21 Feb 2024 11:41:35 +0000 Subject: [PATCH] chore: v0.7.0 --- CHANGELOG.md | 4 +++ pubspec.yaml | 2 +- tool/release_ready.sh | 79 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 tool/release_ready.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index b44bd4b..1658c3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.7.0 + +- feat!: update Dart version constraints to "^3.0.0" ([#115](https://github.com/VeryGoodOpenSource/formz/pull/115)) + # 0.6.1 - fix(example): update validation to throw on empty values ([#100](https://github.com/VeryGoodOpenSource/formz/pull/100)) diff --git a/pubspec.yaml b/pubspec.yaml index d26dcac..8e5acc3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ issue_tracker: https://github.com/VeryGoodOpenSource/formz/issues homepage: https://github.com/VeryGoodOpenSource/formz documentation: https://github.com/VeryGoodOpenSource/formz -version: 0.6.1 +version: 0.7.0 environment: sdk: ">=3.0.0 <4.0.0" diff --git a/tool/release_ready.sh b/tool/release_ready.sh new file mode 100644 index 0000000..c187fda --- /dev/null +++ b/tool/release_ready.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +# Ensures that the package is ready for a release. +# +# Will update the version.dart file and update the CHANGELOG.md. +# +# Set it up for a new version: +# `./release_ready.sh + +# Check if current directory is usable for this script, if so we assume it is correctly set up. +if [ ! -f "pubspec.yaml" ]; then + echo "$(pwd) is not a valid (dart/npm) package or brick." + exit 1 +fi + +currentBranch=$(git symbolic-ref --short -q HEAD) +if [[ ! $currentBranch == "main" ]]; then + echo "Releasing is only supported on the main branch." + exit 1 +fi + +# Get information +old_version=$(dart pub deps --json | pcregrep -o1 -i '"version": "(.*?)"' | head -1) + +if [ -z "$old_version" ]; then + echo "Current version was not resolved." + exit 1 +fi + +# Get new version +new_version="$1"; + +if [[ "$new_version" == "" ]]; then + echo "No new version supplied, please provide one" + exit 1 +fi + +if [[ "$new_version" == "$old_version" ]]; then + echo "Current version is $old_version, can't update." + exit 1 +fi + +# Retrieving all the commits in the current directory since the last tag. +previousTag="v${old_version}" +raw_commits="$(git log --pretty=format:"%s" --no-merges --reverse $previousTag..HEAD -- .)" +markdown_commits=$(echo "$raw_commits" | sed -En "s/\(#([0-9]+)\)/([#\1](https:\/\/github.com\/VeryGoodOpenSource\/formz\/pull\/\1))/p") + +if [[ "$markdown_commits" == "" ]]; then + echo "No commits since last tag, can't update." + exit 0 +fi +commits=$(echo "$markdown_commits" | sed -En "s/^/- /p") + +echo "Updating version to $new_version" +sed -i '' "s/version: $old_version/version: $new_version/g" pubspec.yaml + +# Update dart file with new version. +dart run build_runner build --delete-conflicting-outputs > /dev/null + +if grep -q v$new_version "CHANGELOG.md"; then + echo "CHANGELOG already contains version $new_version." + exit 1 +fi + +# Add a new version entry with the found commits to the CHANGELOG.md. +echo "# ${new_version} \n\n ${commits}\n\n$(cat CHANGELOG.md)" > CHANGELOG.md +echo "CHANGELOG generated, validate entries here: $(pwd)/CHANGELOG.md" + +echo "Creating git branch for ver_good_cli@$new_version" +git checkout -b "chore/$new_version" > /dev/null + +git add pubspec.yaml CHANGELOG.md +if [ -f lib/src/version.dart ]; then + git add lib/src/version.dart +fi + +echo "" +echo "Run the following command if you wish to commit the changes:" +echo "git commit -m \"chore: v$new_version\"" \ No newline at end of file