diff --git a/CHANGELOG.md b/CHANGELOG.md index 20e7837..165bfd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ -## [Unreleased] +# Changelog -## [1.0.0] - 2024-03-03 +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). + +## Unreleased changes + +## v1.0.1 (2024-03-04) + +### Performance Improvements +- Speeds up the performance by 2x [`32236ed`](git@github.com:svyatov/clsx-rails/commit/32236ed) + +### Chore +- Fixes CI action [`f1b948c`](git@github.com:svyatov/clsx-rails/commit/f1b948c) +- Upload code coverage to CodeCov for the latest combination of Ruby and ActionView only [`4e5d768`](git@github.com:svyatov/clsx-rails/commit/4e5d768) + +### Documentation +- Adds information about supported Ruby and Rails version [skip ci] [`2e6483f`](git@github.com:svyatov/clsx-rails/commit/2e6483f) +- Adds link to the CodeCov badge, switch to Conventional Commits [`b48cc84`](git@github.com:svyatov/clsx-rails/commit/b48cc84) + +### Other +- Updates CI badge [skip ci] [`a829613`](git@github.com:svyatov/clsx-rails/commit/a829613) +- Adds code coverage tracking [`0c5d34c`](git@github.com:svyatov/clsx-rails/commit/0c5d34c) +- Ignore ruby-head in the CI matrix [`f3ab4df`](git@github.com:svyatov/clsx-rails/commit/f3ab4df) +- Better name for the GitHub Action job [`a28adb7`](git@github.com:svyatov/clsx-rails/commit/a28adb7) +- Adds badges, fixes rubocop configuration for CI [`56fab44`](git@github.com:svyatov/clsx-rails/commit/56fab44) +- Create dependabot.yml [`ed1e0eb`](git@github.com:svyatov/clsx-rails/commit/ed1e0eb) +- Fixes GitHub Actions [`f58a4b2`](git@github.com:svyatov/clsx-rails/commit/f58a4b2) + +## v1.0.0 (2024-03-03) + +### Other +- Initial commit [`f65b9b8`](git@github.com:svyatov/clsx-rails/commit/f65b9b8) -- Initial release diff --git a/Gemfile.lock b/Gemfile.lock index d3e9744..e212833 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - clsx-rails (1.0.0) + clsx-rails (1.0.1) actionview (>= 6.1) GEM diff --git a/bin/changelog b/bin/changelog new file mode 100755 index 0000000..7878946 --- /dev/null +++ b/bin/changelog @@ -0,0 +1,139 @@ +#!/bin/sh + +# Source: https://github.com/smichard/conventional_changelog/blob/main/generate_changelog_local.sh + +# Exit on error +set -e + +# Error handling +trap 'echo "An error occurred at line $LINENO. Exiting."' ERR + +# Path to the Git repository (current directory) +REPO_DIR="." +CHANGELOG_FILE="$REPO_DIR/CHANGELOG.md" +GITHUB_REPO_URL=$(git remote get-url origin 2>/dev/null | sed 's/\.git$//') +if [ -z "$GITHUB_REPO_URL" ]; then + GITHUB_REPO_URL=0 +fi + +echo "Starting changelog generation script..." +echo "Repository:" +echo $GITHUB_REPO_URL +# Create or clear the changelog file +> $CHANGELOG_FILE + +# Add the introductory text to the changelog +echo "# Changelog" >> $CHANGELOG_FILE +echo "" >> $CHANGELOG_FILE +echo "All notable changes to this project will be documented in this file." >> $CHANGELOG_FILE +echo "" >> $CHANGELOG_FILE +echo "The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)." >> $CHANGELOG_FILE +echo "" >> $CHANGELOG_FILE + +# Go to the repository directory +cd $REPO_DIR + +# Fetch the latest changes +git fetch --tags +echo "Fetched latest tags." + +# Get the latest tag +LATEST_TAG=$(git describe --tags --abbrev=0) + +# Get tags in reverse order +TAGS=$(git tag --sort=-v:refname) + +# Check if there are any tags +if [ -z "$TAGS" ]; then + echo "No tags found in the repository." + exit 1 +fi + +echo "Found tags: $TAGS" + +# Placeholder for the previous tag +TAG_TO=HEAD + +# Define categories +CATEGORIES="feat fix perf chore docs refactor" + +# Regular expression for matching conventional commits +CONVENTIONAL_COMMIT_REGEX="^.* (feat|fix|perf|chore|docs|refactor)(\(.*\))?: " + +print_tag() { + echo "Processing tag: $2" + TAG_DATE=$(git log -1 --format=%ai $2 | cut -d ' ' -f 1) + if [ "$2" = "HEAD" ]; then + if [ $(git rev-parse $1) != $(git rev-parse "HEAD") ]; then + echo "## Unreleased changes" >> $CHANGELOG_FILE + echo "" >> $CHANGELOG_FILE + fi + else + echo "## $2 ($TAG_DATE)" >> $CHANGELOG_FILE + echo "" >> $CHANGELOG_FILE + fi + + + # Collect all commits for this tag range + if [ -z "$1" ]; then + ALL_COMMITS=$(git log $2 --oneline --always) + else + ALL_COMMITS=$(git log $1..$2 --oneline --always) + fi + + # Process each category + for KEY in $CATEGORIES; do + CATEGORY_COMMITS=$(echo "$ALL_COMMITS" | grep -E "^.* $KEY(\(.*\))?: " || true) + if [ ! -z "$CATEGORY_COMMITS" ]; then + case $KEY in + "feat") CATEGORY_NAME="Feature" ;; + "fix") CATEGORY_NAME="Bug Fixes" ;; + "perf") CATEGORY_NAME="Performance Improvements" ;; + "chore") CATEGORY_NAME="Chore" ;; + "docs") CATEGORY_NAME="Documentation" ;; + "refactor") CATEGORY_NAME="Refactor" ;; + esac + echo "### $CATEGORY_NAME" >> $CHANGELOG_FILE + echo "Listing commits for category: $CATEGORY_NAME under tag $2" + echo "$CATEGORY_COMMITS" | while read -r COMMIT; do + HASH=$(echo $COMMIT | awk '{print $1}') + MESSAGE=$(echo $COMMIT | sed -E "s/^$HASH $KEY(\(.*\))?: //") + if [ "$GITHUB_REPO_URL" != "0" ]; then + echo "- $MESSAGE [\`$HASH\`]($GITHUB_REPO_URL/commit/$HASH)" >> $CHANGELOG_FILE + else + echo "- $MESSAGE" >> $CHANGELOG_FILE + fi + done + echo "" >> $CHANGELOG_FILE + fi + done + + # Process 'Other' category + OTHER_COMMITS=$(echo "$ALL_COMMITS" | grep -v -E "$CONVENTIONAL_COMMIT_REGEX" || true) + if [ ! -z "$OTHER_COMMITS" ]; then + echo "### Other" >> $CHANGELOG_FILE + echo "Listing commits for category: Other under tag $2" + echo "$OTHER_COMMITS" | while read -r COMMIT; do + HASH=$(echo $COMMIT | awk '{print $1}') + MESSAGE=$(echo $COMMIT | sed -E 's/^[^ ]* //') + if [ "$GITHUB_REPO_URL" != "0" ]; then + echo "- $MESSAGE [\`$HASH\`]($GITHUB_REPO_URL/commit/$HASH)" >> $CHANGELOG_FILE + else + echo "- $MESSAGE" >> $CHANGELOG_FILE + fi + done + echo "" >> $CHANGELOG_FILE + fi + + echo "Completed processing tag: $2" + # Update the previous tag +} + +# Iterate over tags +for TAG_FROM in $TAGS; do + print_tag $TAG_FROM $TAG_TO + TAG_TO=$TAG_FROM +done +print_tag "" $TAG_FROM + +echo "Changelog generation complete." diff --git a/lib/clsx/version.rb b/lib/clsx/version.rb index 246090a..2002aad 100644 --- a/lib/clsx/version.rb +++ b/lib/clsx/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Clsx - VERSION = '1.0.0' + VERSION = '1.0.1' end