Skip to content

Commit 124ad94

Browse files
committed
refac
1 parent 710b527 commit 124ad94

1 file changed

Lines changed: 8 additions & 19 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,17 @@ jobs:
2727
echo "::set-output name=version::$VERSION"
2828
2929
- name: Extract latest CHANGELOG entry
30-
id: changelog
3130
run: |
32-
CHANGELOG_CONTENT=$(awk 'BEGIN {print_section=0;} /^## \[/ {if (print_section == 0) {print_section=1;} else {exit;}} print_section {print;}' CHANGELOG.md)
33-
CHANGELOG_ESCAPED=$(echo "$CHANGELOG_CONTENT" | sed ':a;N;$!ba;s/\n/%0A/g')
34-
echo "Extracted latest release notes from CHANGELOG.md:"
35-
echo -e "$CHANGELOG_CONTENT"
36-
echo "::set-output name=content::$CHANGELOG_ESCAPED"
31+
VERSION="${{ steps.get_version.outputs.version }}"
32+
awk "/^## \[${VERSION}\]/{found=1; next} /^## \[/{if(found) exit} found{print}" CHANGELOG.md > /tmp/release-notes.md
3733
3834
- name: Create GitHub release
39-
uses: actions/github-script@v8
40-
with:
41-
github-token: ${{ secrets.GITHUB_TOKEN }}
42-
script: |
43-
const changelog = `${{ steps.changelog.outputs.content }}`;
44-
const release = await github.rest.repos.createRelease({
45-
owner: context.repo.owner,
46-
repo: context.repo.repo,
47-
tag_name: `v${{ steps.get_version.outputs.version }}`,
48-
name: `v${{ steps.get_version.outputs.version }}`,
49-
body: changelog,
50-
})
51-
console.log(`Created release ${release.data.html_url}`)
35+
env:
36+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
run: |
38+
gh release create "v${{ steps.get_version.outputs.version }}" \
39+
--title "v${{ steps.get_version.outputs.version }}" \
40+
--notes-file /tmp/release-notes.md
5241
5342
- name: Upload package to GitHub release
5443
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)