Skip to content

Commit 13b408d

Browse files
committed
docs: Changelog update + version bump
1 parent 32236ed commit 13b408d

File tree

4 files changed

+174
-5
lines changed

4 files changed

+174
-5
lines changed

CHANGELOG.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
1-
## [Unreleased]
1+
# Changelog
22

3-
## [1.0.0] - 2024-03-03
3+
All notable changes to this project will be documented in this file.
4+
5+
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/).
6+
7+
## Unreleased changes
8+
9+
## v1.0.1 (2024-03-04)
10+
11+
### Performance Improvements
12+
- Speeds up the performance by 2x [`32236ed`]([email protected]:svyatov/clsx-rails/commit/32236ed)
13+
14+
### Chore
15+
- Fixes CI action [`f1b948c`]([email protected]:svyatov/clsx-rails/commit/f1b948c)
16+
- Upload code coverage to CodeCov for the latest combination of Ruby and ActionView only [`4e5d768`]([email protected]:svyatov/clsx-rails/commit/4e5d768)
17+
18+
### Documentation
19+
- Adds information about supported Ruby and Rails version [skip ci] [`2e6483f`]([email protected]:svyatov/clsx-rails/commit/2e6483f)
20+
- Adds link to the CodeCov badge, switch to Conventional Commits [`b48cc84`]([email protected]:svyatov/clsx-rails/commit/b48cc84)
21+
22+
### Other
23+
- Updates CI badge [skip ci] [`a829613`]([email protected]:svyatov/clsx-rails/commit/a829613)
24+
- Adds code coverage tracking [`0c5d34c`]([email protected]:svyatov/clsx-rails/commit/0c5d34c)
25+
- Ignore ruby-head in the CI matrix [`f3ab4df`]([email protected]:svyatov/clsx-rails/commit/f3ab4df)
26+
- Better name for the GitHub Action job [`a28adb7`]([email protected]:svyatov/clsx-rails/commit/a28adb7)
27+
- Adds badges, fixes rubocop configuration for CI [`56fab44`]([email protected]:svyatov/clsx-rails/commit/56fab44)
28+
- Create dependabot.yml [`ed1e0eb`]([email protected]:svyatov/clsx-rails/commit/ed1e0eb)
29+
- Fixes GitHub Actions [`f58a4b2`]([email protected]:svyatov/clsx-rails/commit/f58a4b2)
30+
31+
## v1.0.0 (2024-03-03)
32+
33+
### Other
34+
- Initial commit [`f65b9b8`]([email protected]:svyatov/clsx-rails/commit/f65b9b8)
435

5-
- Initial release

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
clsx-rails (1.0.0)
4+
clsx-rails (1.0.1)
55
actionview (>= 6.1)
66

77
GEM

bin/changelog

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
#!/bin/sh
2+
3+
# Source: https://github.com/smichard/conventional_changelog/blob/main/generate_changelog_local.sh
4+
5+
# Exit on error
6+
set -e
7+
8+
# Error handling
9+
trap 'echo "An error occurred at line $LINENO. Exiting."' ERR
10+
11+
# Path to the Git repository (current directory)
12+
REPO_DIR="."
13+
CHANGELOG_FILE="$REPO_DIR/CHANGELOG.md"
14+
GITHUB_REPO_URL=$(git remote get-url origin 2>/dev/null | sed 's/\.git$//')
15+
if [ -z "$GITHUB_REPO_URL" ]; then
16+
GITHUB_REPO_URL=0
17+
fi
18+
19+
echo "Starting changelog generation script..."
20+
echo "Repository:"
21+
echo $GITHUB_REPO_URL
22+
# Create or clear the changelog file
23+
> $CHANGELOG_FILE
24+
25+
# Add the introductory text to the changelog
26+
echo "# Changelog" >> $CHANGELOG_FILE
27+
echo "" >> $CHANGELOG_FILE
28+
echo "All notable changes to this project will be documented in this file." >> $CHANGELOG_FILE
29+
echo "" >> $CHANGELOG_FILE
30+
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
31+
echo "" >> $CHANGELOG_FILE
32+
33+
# Go to the repository directory
34+
cd $REPO_DIR
35+
36+
# Fetch the latest changes
37+
git fetch --tags
38+
echo "Fetched latest tags."
39+
40+
# Get the latest tag
41+
LATEST_TAG=$(git describe --tags --abbrev=0)
42+
43+
# Get tags in reverse order
44+
TAGS=$(git tag --sort=-v:refname)
45+
46+
# Check if there are any tags
47+
if [ -z "$TAGS" ]; then
48+
echo "No tags found in the repository."
49+
exit 1
50+
fi
51+
52+
echo "Found tags: $TAGS"
53+
54+
# Placeholder for the previous tag
55+
TAG_TO=HEAD
56+
57+
# Define categories
58+
CATEGORIES="feat fix perf chore docs refactor"
59+
60+
# Regular expression for matching conventional commits
61+
CONVENTIONAL_COMMIT_REGEX="^.* (feat|fix|perf|chore|docs|refactor)(\(.*\))?: "
62+
63+
print_tag() {
64+
echo "Processing tag: $2"
65+
TAG_DATE=$(git log -1 --format=%ai $2 | cut -d ' ' -f 1)
66+
if [ "$2" = "HEAD" ]; then
67+
if [ $(git rev-parse $1) != $(git rev-parse "HEAD") ]; then
68+
echo "## Unreleased changes" >> $CHANGELOG_FILE
69+
echo "" >> $CHANGELOG_FILE
70+
fi
71+
else
72+
echo "## $2 ($TAG_DATE)" >> $CHANGELOG_FILE
73+
echo "" >> $CHANGELOG_FILE
74+
fi
75+
76+
77+
# Collect all commits for this tag range
78+
if [ -z "$1" ]; then
79+
ALL_COMMITS=$(git log $2 --oneline --always)
80+
else
81+
ALL_COMMITS=$(git log $1..$2 --oneline --always)
82+
fi
83+
84+
# Process each category
85+
for KEY in $CATEGORIES; do
86+
CATEGORY_COMMITS=$(echo "$ALL_COMMITS" | grep -E "^.* $KEY(\(.*\))?: " || true)
87+
if [ ! -z "$CATEGORY_COMMITS" ]; then
88+
case $KEY in
89+
"feat") CATEGORY_NAME="Feature" ;;
90+
"fix") CATEGORY_NAME="Bug Fixes" ;;
91+
"perf") CATEGORY_NAME="Performance Improvements" ;;
92+
"chore") CATEGORY_NAME="Chore" ;;
93+
"docs") CATEGORY_NAME="Documentation" ;;
94+
"refactor") CATEGORY_NAME="Refactor" ;;
95+
esac
96+
echo "### $CATEGORY_NAME" >> $CHANGELOG_FILE
97+
echo "Listing commits for category: $CATEGORY_NAME under tag $2"
98+
echo "$CATEGORY_COMMITS" | while read -r COMMIT; do
99+
HASH=$(echo $COMMIT | awk '{print $1}')
100+
MESSAGE=$(echo $COMMIT | sed -E "s/^$HASH $KEY(\(.*\))?: //")
101+
if [ "$GITHUB_REPO_URL" != "0" ]; then
102+
echo "- $MESSAGE [\`$HASH\`]($GITHUB_REPO_URL/commit/$HASH)" >> $CHANGELOG_FILE
103+
else
104+
echo "- $MESSAGE" >> $CHANGELOG_FILE
105+
fi
106+
done
107+
echo "" >> $CHANGELOG_FILE
108+
fi
109+
done
110+
111+
# Process 'Other' category
112+
OTHER_COMMITS=$(echo "$ALL_COMMITS" | grep -v -E "$CONVENTIONAL_COMMIT_REGEX" || true)
113+
if [ ! -z "$OTHER_COMMITS" ]; then
114+
echo "### Other" >> $CHANGELOG_FILE
115+
echo "Listing commits for category: Other under tag $2"
116+
echo "$OTHER_COMMITS" | while read -r COMMIT; do
117+
HASH=$(echo $COMMIT | awk '{print $1}')
118+
MESSAGE=$(echo $COMMIT | sed -E 's/^[^ ]* //')
119+
if [ "$GITHUB_REPO_URL" != "0" ]; then
120+
echo "- $MESSAGE [\`$HASH\`]($GITHUB_REPO_URL/commit/$HASH)" >> $CHANGELOG_FILE
121+
else
122+
echo "- $MESSAGE" >> $CHANGELOG_FILE
123+
fi
124+
done
125+
echo "" >> $CHANGELOG_FILE
126+
fi
127+
128+
echo "Completed processing tag: $2"
129+
# Update the previous tag
130+
}
131+
132+
# Iterate over tags
133+
for TAG_FROM in $TAGS; do
134+
print_tag $TAG_FROM $TAG_TO
135+
TAG_TO=$TAG_FROM
136+
done
137+
print_tag "" $TAG_FROM
138+
139+
echo "Changelog generation complete."

lib/clsx/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Clsx
4-
VERSION = '1.0.0'
4+
VERSION = '1.0.1'
55
end

0 commit comments

Comments
 (0)