Skip to content

Commit

Permalink
optimize workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mustakshif committed May 21, 2024
1 parent d4208d8 commit 726a599
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,29 @@ jobs:
exit 1
fi
CHANGELOG_CONTENT=$(awk '/^### / {if (p) exit; p=1} p' "$CHANGELOG_FILE")
CHANGELOG_CONTENT=$(awk '/^## / {print; getline; while ($0 !~ /^### / && $0 != "") {print; getline}}' "$CHANGELOG_FILE")
if [ -z "$CHANGELOG_CONTENT" ]; then
echo "Error: Could not extract the latest changelog entry."
echo "::error::Extracted content is empty."
exit 1
fi
echo "Extracted changelog content:"
echo "$CHANGELOG_CONTENT"
echo "::set-output name=content::$CHANGELOG_CONTENT"
- name: Create annotated tag with changelog
- name: Create or update annotated tag with changelog
run: |
TAG_NAME="${{ github.ref_name }}"
CHANGELOG_CONTENT="${{ steps.changelog.outputs.content }}"
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "Tag $TAG_NAME already exists. Updating tag message."
git tag -d "$TAG_NAME"
git push origin :"$TAG_NAME"
fi
git tag -a "$TAG_NAME" -m "$CHANGELOG_CONTENT"
git push origin "$TAG_NAME"
Expand Down

0 comments on commit 726a599

Please sign in to comment.