diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b6b84..02e313d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.2.1 + +- docs: add brickhub badge ([#20](https://github.com/VeryGoodOpenSource/flutter_web_preloader/pull/20)) +- chore: Removes duplicate script from index.html ([#24](https://github.com/VeryGoodOpenSource/flutter_web_preloader/pull/24)) + # 0.2.0 - fix: Loads app even when there's no assets (#12) diff --git a/brick.yaml b/brick.yaml index 6409041..b6e97ba 100644 --- a/brick.yaml +++ b/brick.yaml @@ -1,7 +1,7 @@ name: flutter_web_preloader description: A brick that creates a smart web entry point for Flutter that preloads its assets before starting the app. repository: https://github.com/VeryGoodOpenSource/flutter_web_preloader -version: 0.2.0 +version: 0.2.1 environment: mason: ">=0.1.0-dev.50 <0.1.0" diff --git a/tool/release_ready.sh b/tool/release_ready.sh new file mode 100644 index 0000000..935961c --- /dev/null +++ b/tool/release_ready.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +# Ensures that the brick is ready for a release. +# +# Will update the brick.yaml 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 "brick.yaml" ]; then + echo "$(pwd) is not a valid 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="" +if [ -f "brick.yaml" ]; then + old_version=$(cat brick.yaml | pcregrep 'version: (.*?)' | tr " " "\n" | tail -1) +fi + +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\/flutter_web_preloader\/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" +if [ -f "brick.yaml" ]; then + sed -i '' "s/version: $old_version/version: $new_version/g" brick.yaml +fi + +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/flutter_web_preloader-v$new_version" > /dev/null + +git add brick.yaml CHANGELOG.md + +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