From c7ffad5d5426e762b2d8a9086c44b35c088d3cd7 Mon Sep 17 00:00:00 2001 From: Tom Arra Date: Wed, 18 Dec 2024 08:28:38 -0600 Subject: [PATCH] chore(very_good_docs_site): v0.0.4 (#228) --- very_good_docs_site/CHANGELOG.md | 8 +++ very_good_docs_site/brick.yaml | 2 +- very_good_docs_site/tool/release_ready.sh | 78 +++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100755 very_good_docs_site/tool/release_ready.sh diff --git a/very_good_docs_site/CHANGELOG.md b/very_good_docs_site/CHANGELOG.md index ed69afd..1aa509a 100644 --- a/very_good_docs_site/CHANGELOG.md +++ b/very_good_docs_site/CHANGELOG.md @@ -1,3 +1,11 @@ +# 0.0.4 + +- feat: update pull request templates to add `test` type option ([#214](https://github.com/VeryGoodOpenSource/very_good_templates/pull/214)) +- chore(deps-dev): bump @docusaurus/module-type-aliases from 3.3.2 to 3.4.0 in /very_good_docs_site/**brick**/{{project_name.snakeCase()}} ([#118](https://github.com/VeryGoodOpenSource/very_good_templates/pull/118)) +- chore(deps-dev): bump eslint from 8.57.0 to 9.2.0 in /very_good_docs_site/**brick**/{{project_name.snakeCase()}} ([#94](https://github.com/VeryGoodOpenSource/very_good_templates/pull/94)) +- chore(deps-dev): bump @docusaurus/module-type-aliases from 3.4.0 to 3.5.2 in /very_good_docs_site/**brick**/{{project_name.snakeCase()}} ([#175](https://github.com/VeryGoodOpenSource/very_good_templates/pull/175)) +- chore(deps-dev): bump @docusaurus/module-type-aliases from 3.5.2 to 3.6.0 in /very_good_docs_site/**brick**/{{project_name.snakeCase()}} ([#212](https://github.com/VeryGoodOpenSource/very_good_templates/pull/212)) + # 0.0.3 - chore: migrate very_good_docs_site ([#6](https://github.com/VeryGoodOpenSource/very_good_templates/pull/6)) diff --git a/very_good_docs_site/brick.yaml b/very_good_docs_site/brick.yaml index 39ba819..7476a1b 100644 --- a/very_good_docs_site/brick.yaml +++ b/very_good_docs_site/brick.yaml @@ -1,7 +1,7 @@ name: very_good_docs_site description: A Very Good documentation site created by Very Good Ventures. repository: https://github.com/VeryGoodOpenSource/very_good_templates/tree/main/very_good_docs_site -version: 0.0.3 +version: 0.0.4 environment: mason: ^0.1.0 diff --git a/very_good_docs_site/tool/release_ready.sh b/very_good_docs_site/tool/release_ready.sh new file mode 100755 index 0000000..c7cdd40 --- /dev/null +++ b/very_good_docs_site/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="very_good_docs_site-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\/very_good_templates\/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 very_good_docs_site@$new_version" +git checkout -b "chore/very_good_docs_site-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(very_good_docs_site): v$new_version\"" \ No newline at end of file