From 22cc556ee5804963094a128c43d9f822884382b7 Mon Sep 17 00:00:00 2001 From: Michal Pokrywka Date: Wed, 14 Oct 2026 20:25:04 +0200 Subject: [PATCH] Prepared 0.2.2 --- CHANGES.md | 2 +- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 4 +- scripts/github_release.sh | 125 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 130 insertions(+), 5 deletions(-) create mode 100755 scripts/github_release.sh diff --git a/CHANGES.md b/CHANGES.md index 760c620..d64a84c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,7 @@ -## Unreleased +## 0.2.2 - 2026-10-14 ### Added diff --git a/Cargo.lock b/Cargo.lock index 4912495..e708d12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3947,7 +3947,7 @@ dependencies = [ [[package]] name = "vertigo-forms" -version = "0.2.1" +version = "0.2.2" dependencies = [ "base64 0.23.1", "either", diff --git a/Cargo.toml b/Cargo.toml index 35374f9..61ff412 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["storybook", "examples/manual_form", "examples/model_form", "e2e"] [package] name = "vertigo-forms" -version = "0.2.1" +version = "0.2.2" authors = ["MichaƂ Pokrywka "] description = "Building block for forms in vertigo" readme = { workspace = true } diff --git a/README.md b/README.md index 8fa5ded..225db74 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Blocks for building forms in [vertigo](https://crates.io/crates/vertigo). [![crates.io](https://img.shields.io/crates/v/vertigo-forms)](https://crates.io/crates/vertigo-forms) [![Documentation](https://docs.rs/vertigo-forms/badge.svg)](https://docs.rs/vertigo-forms) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/vertigo-forms.svg) -[![Dependency Status](https://deps.rs/crate/vertigo-forms/0.2.1/status.svg)](https://deps.rs/crate/vertigo-forms/0.2.1) +[![Dependency Status](https://deps.rs/crate/vertigo-forms/0.2.2/status.svg)](https://deps.rs/crate/vertigo-forms/0.2.2) [![CI](https://github.com/vertigo-web/vertigo-forms/actions/workflows/pipeline.yaml/badge.svg)](https://github.com/vertigo-web/vertigo-forms/actions/workflows/pipeline.yaml) [![downloads](https://img.shields.io/crates/d/vertigo-forms.svg)](https://crates.io/crates/vertigo-forms) @@ -17,7 +17,7 @@ Dependencies: ```toml vertigo = "0.13" -vertigo-forms = "0.1" +vertigo-forms = "0.2" ``` Example 1: diff --git a/scripts/github_release.sh b/scripts/github_release.sh new file mode 100755 index 0000000..7e84d8b --- /dev/null +++ b/scripts/github_release.sh @@ -0,0 +1,125 @@ +#!/usr/bin/env bash + +# Tags HEAD and creates a GitHub release from the newest docs/CHANGELOG.md entry. +# Without arguments prints the usage. + +set -euo pipefail + +CHANGELOG=CHANGES.md + +usage() { + cat << EOF +Usage: $0 --dry-run | --release + +Tags HEAD with the version of the newest $CHANGELOG entry, pushes the tag and creates +a GitHub release from the entry: tag vX.Y.Z, title "X.Y.Z - YYYY-MM-DD" (the heading), +the entry as the notes. + +Run from the main directory of the repository, on master, after the "Prepared X.Y.Z" commit +is pushed. + + --dry-run print the tag, title and notes, and the checks that would fail, change nothing + --release tag, push the tag and create the release (asks first) +EOF +} + +DRY_RUN= +case "${1:-}" in + --dry-run) DRY_RUN=1 ;; + --release) ;; + -h | --help) + usage + exit 0 + ;; + *) + usage >&2 + exit 2 + ;; +esac +if [ $# -gt 1 ]; then + usage >&2 + exit 2 +fi + +FAILED= +fail() { + echo "Error: $1" >&2 + if [ -z "$DRY_RUN" ]; then + exit 1 + fi + FAILED=1 +} + +# The first "## " heading and the lines up to the next one, without blank lines around +TITLE=$(grep -m1 '^## ' "$CHANGELOG" | sed 's/^## //') +NOTES=$(awk ' + /^## / { if (seen++) exit; next } + seen { lines[++n] = $0 } + END { + first = 1; while (first <= n && lines[first] == "") first++ + last = n; while (last >= first && lines[last] == "") last-- + for (i = first; i <= last; i++) print lines[i] + } +' "$CHANGELOG") + +if [[ ! $TITLE =~ ^([0-9]+\.[0-9]+\.[0-9]+)\ -\ [0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then + echo "Error: the newest $CHANGELOG entry \"$TITLE\" isn't \"X.Y.Z - YYYY-MM-DD\"" >&2 + exit 1 +fi +VERSION=${BASH_REMATCH[1]} +TAG="v$VERSION" + +if [ -z "$NOTES" ]; then + fail "the $CHANGELOG entry for $VERSION is empty" +fi + +CARGO_VERSION=$(grep -m1 '^version = ' Cargo.toml | cut -d'"' -f2) +if [ "$CARGO_VERSION" != "$VERSION" ]; then + fail "Cargo.toml has version $CARGO_VERSION, $CHANGELOG $VERSION" +fi + +if ! gh auth status > /dev/null 2>&1; then + fail "gh isn't installed or logged in (gh auth login)" +fi + +if [ -n "$(git status --porcelain)" ]; then + fail "the working tree has uncommitted changes" +fi + +git fetch --quiet origin master +if ! git merge-base --is-ancestor HEAD origin/master; then + fail "HEAD ($(git log -1 --format='%h %s')) isn't on origin/master" +fi + +if git rev-parse --quiet --verify "refs/tags/$TAG" > /dev/null; then + fail "tag $TAG exists already" +fi +if git ls-remote --exit-code --tags origin "refs/tags/$TAG" > /dev/null; then + fail "tag $TAG exists on origin already" +fi + +echo "Tag: $TAG -> $(git log -1 --format='%h %s')" +echo "Title: $TITLE" +echo "Notes:" +echo +echo "$NOTES" +echo + +if [ -n "$DRY_RUN" ]; then + if [ -n "$FAILED" ]; then + echo "Dry run: the checks above would stop the release." + exit 1 + fi + echo "Dry run: nothing changed." + exit 0 +fi + +read -r -p "Push tag $TAG and publish the release? [y/N] " ANSWER +if [ "$ANSWER" != "y" ] && [ "$ANSWER" != "Y" ]; then + echo "Aborted." + exit 1 +fi + +git tag "$TAG" +git push origin "$TAG" +gh release create "$TAG" --verify-tag --title "$TITLE" --notes-file - <<< "$NOTES"