Skip to content

Commit

Permalink
gh-39194: Reimplement release creation workflow
Browse files Browse the repository at this point in the history
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes #12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes #12345". -->

Fixes the issue raised in
sagemath/website#480 (comment)

I manually edited the release
https://github.com/sagemath/sage/releases/tag/10.5 generated by an
workflow implemented in sagemath/website#480 to
correct the changelog https://github.com/sagemath/website/blob/master/sr
c/changelogs/sage-10.5.txt, which is now in good shape. But see, for
example, https://github.com/sagemath/sage/releases/tag/10.4 that
contains all changes in betas and rcs.

This PR is for automatic generation of a release that contains only
changes from the last release.

test:
https://github.com/kwankyu/sage/releases
https://github.com/kwankyu/sage/actions/runs/12485317339/job/34844199681

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - #12345: short description why this is a dependency -->
<!-- - #34567: ... -->
    
URL: #39194
Reported by: Kwankyu Lee
Reviewer(s): Soham Rane
  • Loading branch information
Release Manager committed Jan 2, 2025
2 parents a5c4b48 + 28ef753 commit 65a38a5
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,36 @@ jobs:
with:
name: dist
path: dist
- uses: softprops/action-gh-release@v2
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
latest_release_tag=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases \
| jq -r 'sort_by(.created_at) | last(.[]).tag_name')
release_notes=$(curl -s \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \
-d "{
\"tag_name\": \"${{ github.ref_name }}\",
\"previous_tag_name\": \"$latest_release_tag\"
}" | jq -r '.body')
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases \
-d "{
\"tag_name\": \"${{ github.ref_name }}\",
\"prerelease\": ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }},
\"body\": \"$release_notes\"
}"
- name: Create release assets
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
files: |
dist/*
upstream/*
Expand Down

0 comments on commit 65a38a5

Please sign in to comment.