Skip to content

Commit 309176d

Browse files
committed
CI: properly detect changelog for release
1 parent 855fbfd commit 309176d

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

CHANGELOG.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,43 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7-
## [1.4.0] - 2025-01-08
7+
## [v1.4.0] - 2025-01-08
88
### Changed
99
- `calendar.go` add year 2025.
1010
- `main.go` add debug info for time report to find the reason why report is empty on last day of every month.
1111

12-
## [1.3.1] - 2024-02-04
12+
## [v1.3.1] - 2024-02-04
1313
### Fixed
1414
- `main.go` fix month number at report generation.
1515

16-
## [1.3.0] - 2024-01-17
16+
## [v1.3.0] - 2024-01-17
1717
### Added
1818
- `calendar.go` that has an embedded working hours calendar.
1919

2020
### Changed
2121
- `-report` returns not only spent time but also number of working hours for the current month.
2222

23-
## [1.2.0] - 2024-01-16
23+
## [v1.2.0] - 2024-01-16
2424
### Added
2525
- `-report` flag to generate daily, weekly and monthly recorded hours.
2626
- `-logReport` to show **tired** log even when doing a report (`-report`).
2727

28-
## [1.1.0] - 2024-01-14
28+
## [v1.1.0] - 2024-01-14
2929
### Changed
3030
- Split code onto files.
3131

3232
### Added
3333
- Records validation.
3434
- Records number.
3535

36-
## [1.0.2] - 2023-08-03
36+
## [v1.0.2] - 2023-08-03
3737
### Fixed
3838
- Skip unfinished lines.
3939

40-
## [1.0.1] - 2023-08-02
40+
## [v1.0.1] - 2023-08-02
4141
### Fixed
4242
- Don't split comment with `,` sign.
4343

44-
## [1.0.0] - 2023-07-28
44+
## [v1.0.0] - 2023-07-28
4545
### Added
4646
- First release.

scripts/read_changelog.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG=CHANGELOG.md
66
FOUND=0
77

88
TAG=$1
9+
TAG_BASE=$(echo "${TAG}" | cut -d- -f1)
910

1011
stringContain() {
1112
case $1 in
@@ -21,7 +22,7 @@ stringContain() {
2122
while IFS= read -r LINE; do
2223
case "$FOUND" in
2324
0)
24-
if stringContain "${LINE}" "## [${TAG}"; then
25+
if stringContain "${LINE}" "## [${TAG_BASE}"; then
2526
echo "${LINE}"
2627
FOUND=$((FOUND + 1))
2728
fi
@@ -38,3 +39,10 @@ while IFS= read -r LINE; do
3839
;;
3940
esac
4041
done <$CHANGELOG
42+
43+
if [ $FOUND -gt 0 ]; then
44+
exit 0
45+
else
46+
echo "Version '${TAG_BASE}' is not found at ${CHANGELOG}."
47+
exit 1
48+
fi

0 commit comments

Comments
 (0)