Skip to content

Commit

Permalink
ci: update release job to automatically generate release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
BobanL committed Jan 23, 2025
1 parent bac3146 commit 55c6d0a
Showing 1 changed file with 3 additions and 37 deletions.
40 changes: 3 additions & 37 deletions .github/workflows/createNewRelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,46 +63,12 @@ jobs:
run: |
VERSION_WITH_PHDI=$(poetry version)
echo "version=${VERSION_WITH_PHDI:5}" >> $GITHUB_OUTPUT
# Create new release tag
- name: Set up Git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Tag Release
uses: EndBug/latest-tag@latest
with:
ref: ${{ steps.get_version.outputs.version }}
# Generate release notes
- name: Generate release notes
id: release_notes
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.get_version.outputs.version }}
run: |
latest_release_date=$(gh api "/repos/$GITHUB_REPOSITORY/releases?per_page=1" | jq ".[0].created_at")
prs=$(gh pr list --base main --state closed --json title,number,url,closedAt -q ".[] | select(.closedAt > $latest_release_date) | select(.title | contains(\"RELEASE\") | not)")
echo "# Release Notes" > release-notes.md
echo "" >> release-notes.md
echo "" >> release-notes.md
while IFS= read -r pr; do
pr_title=$(echo "$pr" | jq -r ".title")
pr_number=$(echo "$pr" | jq -r ".number")
pr_url=$(echo "$pr" | jq -r ".url")
line_text="- $pr_title ([#$pr_number]($pr_url))"
echo $line_text >> release-notes.md
done < <(printf '%s' "$prs")
# Create new release based upon the latest created tag
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.version }}
release_name: ${{ steps.get_version.outputs.version }}
body_path: release-notes.md
gh release create "$tag" --generate-notes
release-to-pypi:
name: Build and publish PHDI to PyPI
Expand Down

0 comments on commit 55c6d0a

Please sign in to comment.