Skip to content

Commit 30320fb

Browse files
committed
chore(build): added release-notes
1 parent cfe42e6 commit 30320fb

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/build-prod.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,48 @@ jobs:
6060
name: notorization-logs
6161
path: notarization-error.log
6262
if-no-files-found: ignore
63+
update-release-notes:
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Checkout repository
67+
uses: actions/checkout@v3
68+
69+
- name: Set up GitHub CLI
70+
uses: cli/cli@v3
71+
with:
72+
github_token: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Generate Release Notes between Tags
75+
id: generate_notes
76+
run: |
77+
# Get the tag being pushed (e.g., v1.0.0)
78+
TAG=${GITHUB_REF#refs/tags/}
79+
80+
# Find the previous tag, ensuring it exists (exclude the current tag)
81+
PREV_TAG=$(git tag --sort=v:refname | grep -B 1 "$TAG" | head -n 1)
82+
83+
# If PREV_TAG is the same as the current tag, adjust
84+
if [ "$PREV_TAG" == "$TAG" ]; then
85+
PREV_TAG=$(git tag --sort=v:refname | grep -B 2 "$TAG" | head -n 1)
86+
fi
87+
88+
if [ -z "$PREV_TAG" ]; then
89+
echo "Error: Previous tag not found."
90+
exit 1
91+
fi
92+
93+
# Generate the release notes using GitHub API
94+
NOTES=$(gh api repos/NethServer/nethlink/releases/generate-notes \
95+
-f tag_name="$TAG" -f previous_tag_name="$PREV_TAG" -q .body \
96+
)
97+
98+
# Save the release notes to an output variable
99+
echo "::set-output name=release_notes::$NOTES"
100+
101+
- name: Update Release Notes in GitHub
102+
run: |
103+
# Get the tag being pushed
104+
TAG=${GITHUB_REF#refs/tags/}
105+
106+
# Update the release with the generated notes
107+
gh release edit $TAG --notes "${{ steps.generate_notes.outputs.release_notes }}"

0 commit comments

Comments
 (0)