Approval-based snapshot testing library for Go (mirror)
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: version tagging script and bump shutter version in TUI

+96 -1
+1 -1
cmd/shutter/go.mod
··· 6 6 github.com/charmbracelet/bubbles v0.21.0 7 7 github.com/charmbracelet/bubbletea v1.3.10 8 8 github.com/charmbracelet/lipgloss v1.1.0 9 - github.com/ptdewey/shutter v0.1.4 9 + github.com/ptdewey/shutter v0.2.0 10 10 ) 11 11 12 12 require (
+8
justfile
··· 19 19 20 20 clean: 21 21 @rm -rf ./__snapshots__ 22 + 23 + # Determine next version from conventional commits and tag both modules 24 + release: 25 + @./scripts/version.sh 26 + 27 + # Preview version bump without creating tags 28 + release-dry: 29 + @./scripts/version.sh --dry-run
+87
scripts/version.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + # Determine next semver based on conventional commits since main. 5 + # Usage: ./scripts/version.sh [--dry-run] 6 + 7 + DRY_RUN=false 8 + if [[ "${1:-}" == "--dry-run" ]]; then 9 + DRY_RUN=true 10 + fi 11 + 12 + # Get the latest root module tag (ignore cmd/shutter/ prefixed tags) 13 + LATEST_TAG=$(jj tag list | grep -E '^v[0-9]' | sort -V -t: -k1,1 | tail -1 | awk '{print $1}' | tr -d ':') 14 + 15 + if [[ -z "$LATEST_TAG" ]]; then 16 + echo "error: no existing version tags found" 17 + exit 1 18 + fi 19 + 20 + echo "Current version: $LATEST_TAG" 21 + 22 + # Parse current version 23 + VERSION="${LATEST_TAG#v}" 24 + IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" 25 + 26 + # Get commit messages since main 27 + COMMITS=$(jj log -r 'main..@' --no-graph -T 'description ++ "---\n"' 2>/dev/null) 28 + 29 + if [[ -z "$COMMITS" || "$COMMITS" == $'---\n' ]]; then 30 + echo "No commits since main." 31 + exit 0 32 + fi 33 + 34 + echo "" 35 + echo "Commits since main:" 36 + echo "$COMMITS" | grep -v '^---$' | grep -v '^$' | sed 's/^/ /' 37 + echo "" 38 + 39 + # Determine bump type from conventional commits 40 + BUMP="patch" 41 + 42 + while IFS= read -r line; do 43 + # Skip empty lines and delimiters 44 + [[ -z "$line" || "$line" == "---" ]] && continue 45 + 46 + # Check for breaking changes 47 + if echo "$line" | grep -qiE '^[a-z]+(\(.+\))?!:|BREAKING CHANGE'; then 48 + BUMP="major" 49 + break 50 + fi 51 + 52 + # Check for feat -> minor 53 + if echo "$line" | grep -qE '^feat(\(.+\))?:'; then 54 + BUMP="minor" 55 + fi 56 + done <<< "$COMMITS" 57 + 58 + # Calculate new version 59 + case "$BUMP" in 60 + major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;; 61 + minor) MINOR=$((MINOR + 1)); PATCH=0 ;; 62 + patch) PATCH=$((PATCH + 1)) ;; 63 + esac 64 + 65 + NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}" 66 + 67 + echo "Bump type: $BUMP" 68 + echo "New version: $NEW_VERSION" 69 + echo "Tags: $NEW_VERSION, cmd/shutter/$NEW_VERSION" 70 + 71 + if $DRY_RUN; then 72 + echo "" 73 + echo "(dry run — no tags created)" 74 + exit 0 75 + fi 76 + 77 + echo "" 78 + read -p "Create tags and push? [y/N] " -n 1 -r 79 + echo "" 80 + 81 + if [[ $REPLY =~ ^[Yy]$ ]]; then 82 + jj tag set "$NEW_VERSION" "cmd/shutter/$NEW_VERSION" 83 + jj git push --tags 84 + echo "Done. Tagged and pushed $NEW_VERSION" 85 + else 86 + echo "Aborted." 87 + fi