diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 63e4a46..2de55ce 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -53,6 +53,8 @@ jobs: - name: Generate release notes id: release_notes + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | TAG_NAME="${{ github.ref_name }}" VERSION="${{ steps.validate.outputs.version }}" @@ -67,11 +69,50 @@ jobs: echo "Generating release notes from $PREV_TAG to $TAG_NAME" + # Get list of merged PRs between tags + echo "Fetching merged PRs..." + PR_LIST="" + + # Get merge commits between previous tag and current tag + MERGE_COMMITS=$(git log ${PREV_TAG}..${TAG_NAME} --merges --pretty=format:"%H %s" | grep "Merge pull request #") + + if [ -n "$MERGE_COMMITS" ]; then + while IFS= read -r commit_line; do + # Extract PR number from commit message (format: "Merge pull request #123 from ...") + PR_NUMBER=$(echo "$commit_line" | sed -n 's/.*Merge pull request #\([0-9]*\).*/\1/p') + + if [ -n "$PR_NUMBER" ]; then + # Fetch PR details from GitHub API + PR_DATA=$(gh pr view "$PR_NUMBER" --json title,author --jq '{title: .title, author: .author.login}') + PR_TITLE=$(echo "$PR_DATA" | jq -r '.title') + PR_AUTHOR=$(echo "$PR_DATA" | jq -r '.author') + + # Add to PR list + PR_LIST="${PR_LIST}- ${PR_TITLE} by @${PR_AUTHOR} in [#${PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PR_NUMBER})"$'\n' + fi + done <<< "$MERGE_COMMITS" + fi + # Generate basic release notes cat > release_notes.md << EOF ## Release $VERSION - **Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${TAG_NAME} + ### What's Changed + + EOF + + # Add PR list if available + if [ -n "$PR_LIST" ]; then + echo "$PR_LIST" >> release_notes.md + echo "" >> release_notes.md + else + echo "No merged pull requests found in this release." >> release_notes.md + echo "" >> release_notes.md + fi + + # Add full changelog link + cat >> release_notes.md << EOF + **Full Changelog**: [${PREV_TAG}...${TAG_NAME}](https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${TAG_NAME}) ### Artifacts @@ -105,7 +146,7 @@ jobs: VERSION="${{ steps.validate.outputs.version }}" gh release create "$TAG_NAME" \ - --title "$VERSION" \ + --title "$TAG_NAME" \ --notes-file "${{ steps.release_notes.outputs.release_notes_file }}" \ --draft=false \ --prerelease=false diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index a592f15..c668da6 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -86,6 +86,7 @@ jobs: git config user.email "github-actions[bot]@users.noreply.github.com" - name: Clear git credentials + if: steps.check.outputs.is_version_bump == 'true' && steps.check_label.outputs.skip_tag == 'false' run: | git config --unset-all http.https://github.com/.extraheader || true git config --global --unset-all credential.helper || true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f30b21f..5c90d3e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -126,9 +126,8 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - TAG_NAME="${{ github.event.release.tag_name }}" - gh release upload "$TAG_NAME" \ - ./artifacts/bootstrap.zip#rotel-lambda-forwarder-${TAG_NAME}_${{ matrix.arch }}.zip + id=$(gh api -H "Accept: application/vnd.github+json" /repos/${{ github.repository }}/releases/tags/${{ github.event.release.tag_name }} --jq .id) + curl --fail-with-body -sS -X POST --data-binary @"./artifacts/bootstrap.zip" -H 'Content-Type: application/octet-stream' -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://uploads.github.com/repos/${{ github.repository }}/releases/$id/assets?name=rotel-lambda-forwarder-${{ github.event.release.tag_name }}_${{ matrix.arch }}.zip" upload-cloudformation: name: upload cloudformation - ${{ matrix.arch }}