-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: update release job to automatically generate release notes
- Loading branch information
Showing
1 changed file
with
3 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|