From ebe1b8c2d7883e9dacde1bd98eb85b1c2e200209 Mon Sep 17 00:00:00 2001 From: godcong Date: Thu, 11 Jul 2024 02:28:09 +0800 Subject: [PATCH] feat(github-actions): enhance script to handle initial release tagging The tag_after_test workflow has been updated to support tagging of initial releases when no previous tag exists. This change ensures that the CHANGELOG includes all commits since the beginning of the project by modifying the git log command to include the '--all' option. Additionally, use of echo statements for LATEST_TAG and NEXT_TAG has been added for better debug gability. --- .github/workflows/tag_after_test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tag_after_test.yml b/.github/workflows/tag_after_test.yml index 044b772..5cc61ae 100644 --- a/.github/workflows/tag_after_test.yml +++ b/.github/workflows/tag_after_test.yml @@ -48,6 +48,7 @@ jobs: run: | chmod +x ./scripts/git/commit_tag.sh LATEST_TAG=$(./scripts/git/commit_tag.sh) + echo "LATEST_TAG=$LATEST_TAG" if [[ -z "$LATEST_TAG" ]]; then NEXT_TAG="v0.0.1" else @@ -60,6 +61,7 @@ jobs: PATCH=${VERSION_ARRAY[2]} (( PATCH++ )) NEXT_TAG=v$MAJOR.$MINOR.$PATCH + echo "NEXT_TAG=$NEXT_TAG" echo "NEXT_TAG=$NEXT_TAG" >> $GITHUB_OUTPUT fi @@ -69,7 +71,8 @@ jobs: LATEST_RELEASE=${{ steps.get_latest_release.outputs.LATEST_RELEASE }} if [[ -z "$LATEST_RELEASE" ]]; then # If no release, start from the first commit - CHANGELOG=$(git log --pretty=format:"* %s (%an, %ar)" --reverse) + # Use --all to get all commits, even before the first one + CHANGELOG=$(git log --all --pretty=format:"* %s (%an, %ar)" --reverse) else # Get all submission information since the last release CHANGELOG=$(git log "$LATEST_RELEASE"..HEAD --pretty=format:"* %s (%an, %ar)")