Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- markdownlint-configure-file { "no-duplicate-heading": { "siblings_only": true } } -->

<!-- markdownlint-disable-next-line first-line-h1 -->
## Unreleased
## 0.2.2 - 2026-10-14

### Added

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <wolfmoon@o2.pl>"]
description = "Building block for forms in vertigo"
readme = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -17,7 +17,7 @@ Dependencies:

```toml
vertigo = "0.13"
vertigo-forms = "0.1"
vertigo-forms = "0.2"
```

Example 1:
Expand Down
125 changes: 125 additions & 0 deletions scripts/github_release.sh
Original file line number Diff line number Diff line change
@@ -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"
Loading