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
4 changes: 2 additions & 2 deletions .github/workflows/publish_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:

steps:
- name: Checkout harmony-metadata-annotator repository
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
lfs: true
fetch-depth: 0

- name: Extract semantic version number
run: echo "semantic_version=$(cat docker/service_version.txt)" >> $GITHUB_ENV
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ jobs:

steps:
- name: Checkout harmony-metadata-annotator repository
uses: actions/checkout@v3
with:
lfs: true
uses: actions/checkout@v5

- name: Build service image
run: ./bin/build-image
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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).

## [vX.Y.Z] - Unreleased

### Changed

- Release notes for the Metadata Annotator will now include the commit history
for that release.

## [v1.3.0] - 2025-09-16

### Changed
Expand Down
33 changes: 28 additions & 5 deletions bin/extract-release-notes.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
##################################################################################
#
# Extract release notes for the latest version of Harmony CF Annotator service
# 2025-02-20: Extract release notes for the latest version of Harmony Metadata
# Annotator service
# 2025-09-23: Append git commit messages to release notes.
#
##################################################################################

Expand All @@ -13,13 +15,34 @@ CHANGELOG_FILE="CHANGELOG.md"
VERSION_PATTERN="^## [\[]v"

## captures url links
## [unreleased]:https://github.com/nasa/harmony-cf-annotator/compare/1.2.0..HEAD
## [v1.2.0]: https://github.com/nasa/harmony-cf-annotator/compare/1.1.0..1.2.0
LINK_PATTERN="^\[.*\].*releases/tag/.*"
## [v1.2.0]: https://github.com/nasa/harmony-metadata-annotator/releases/tags/1.2.0
LINK_PATTERN="^\[.*\]:.*https://github.com/nasa"

# Read the file and extract text between the first two occurrences of the
# VERSION_PATTERN
result=$(awk "/$VERSION_PATTERN/{c++; if(c==2) exit;} c==1" "$CHANGELOG_FILE")

# Get all commit messages since the last release (marked with a git tag). If
# there are no tags, get the full commit history of the repository.
if [[ $(git tag) ]]
then
# There are git tags, so get the most recent one
GIT_REF=$(git describe --tags --abbrev=0)
else
# There are not git tags, so get the initial commit of the repository
GIT_REF=$(git rev-list --max-parents=0 HEAD)
fi

# Retrieve the title line of all commit messages since $GIT_REF, filtering out
# those from the pre-commit-ci[bot] author and any containing the string
# "nasa/pre-commit-ci-update-config", which may result from merge commits.
GIT_COMMIT_MESSAGES=$(git log --oneline --format="%s" --perl-regexp --author='^(?!pre-commit-ci\[bot\]).*$' --grep="nasa\/pre-commit-ci-update-config" --invert-grep ${GIT_REF}..HEAD)

# Append git commit messages to the release notes:
if [[ ${GIT_COMMIT_MESSAGES} ]]
then
result+="\n\n## Commits\n\n${GIT_COMMIT_MESSAGES}"
fi

# Print the result
echo "$result" | grep -v "$VERSION_PATTERN" | grep -v "$LINK_PATTERN"
echo -e "$result" | grep -v "$VERSION_PATTERN" | grep -v "$LINK_PATTERN"