Skip to content

Commit

Permalink
Release Notes Generator (#19039)
Browse files Browse the repository at this point in the history
## Description 
Instead of running`./scripts/release_notes.py generate` locally, we
should be doing this via a workflow and also be able to create a new
release within the same workflow.

## Test plan 

https://github.com/MystenLabs/sui/actions/runs/10462421870/job/28972625617
<img width="1305" alt="Screenshot 2024-08-19 at 4 31 48 PM"
src="https://github.com/user-attachments/assets/c30a83b6-e59f-45eb-be5b-496ca22acd9b">
  • Loading branch information
ebmifa authored Aug 20, 2024
1 parent 66f6d48 commit 1012219
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/release-notes-generator.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: Release Notes Generator
name: Create Sui Release with Release Notes

concurrency: ${{ github.workflow }}-${{ inputs.release_tag }}

on:
workflow_dispatch:
Expand All @@ -16,24 +18,41 @@ on:
type: string
required: true

env:
RELEASE_NOTES_FILE: "./release_notes.txt"

jobs:
get-release-notes:
name: Get Release Notes for ${{ inputs.release_tag }} release
runs-on: ubuntu-latest

steps:
- name: Checkout sui repo main branch
- name: Get commits for branches
shell: bash
working-directory: ./
run: |
echo "previous_commit=$(curl https://api.github.com/repos/MystenLabs/sui/commits/${{ inputs.previous_branch }} | jq .sha)" >> $GITHUB_ENV
echo "current_commit=$(curl https://api.github.com/repos/MystenLabs/sui/commits/${{ inputs.current_branch }} | jq .sha)" >> $GITHUB_ENV
- name: Checkout main
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
with:
fetch-depth: 0
ref: main

- name: Setup Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # [email protected]
with:
python-version: 3.10.10

- name: Generate Release Notes
id: release_notes
shell: bash
working-directory: ./
run: |
echo "release_notes=$(./scripts/release_notes.py generate ${{ inputs.previous_branch }} ${{ inputs.current_branch }})" >> $GITHUB_ENV
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python ./scripts/release_notes.py generate ${{ env.previous_commit }} ${{ env.current_commit }} | tee -a ${{ env.RELEASE_NOTES_FILE }}
echo "---" >> ${{ env.RELEASE_NOTES_FILE }}
echo "#### Full Log: https://github.com/MystenLabs/sui/commits/${{ inputs.release_tag }}" >> ${{ env.RELEASE_NOTES_FILE }}
if [[ ${{ inputs.release_tag }} == devnet* ]]; then
echo "pre_release=true" >> $GITHUB_ENV
else
Expand All @@ -47,6 +66,6 @@ jobs:
with:
tag_name: ${{ inputs.release_tag }}
release_name: ${{ inputs.release_tag }}
body: ${{ env.release_notes }}
body_path: ${{ env.RELEASE_NOTES_FILE }}
draft: false
prerelease: ${{ env.pre_release }}
Empty file added release_notes.txt
Empty file.
2 changes: 1 addition & 1 deletion scripts/release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def do_generate(from_, to):
print(f"## {impacted}")

if impacted == "Protocol":
print(f"Sui Protocol Version in this release: {protocol_version}")
print(f"#### Sui Protocol Version in this release: `{protocol_version}`")
print()

for pr, note in reversed(notes):
Expand Down

0 comments on commit 1012219

Please sign in to comment.