Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 35 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,35 @@ jobs:
- name: Generate Changelog
run: bun run changelog

- name: Prepare release notes
run: |
# Extract the newest section from CHANGELOG.md (between the first two
# version headers produced by conventional-changelog).
awk '
/^#{1,3} \[?[0-9]+\.[0-9]+\.[0-9]+/ { count++ }
count == 1 { print }
count == 2 { exit }
' CHANGELOG.md > CHANGES_SECTION.md

{
echo "## 🚀 Release ${{ steps.version.outputs.version }}"
echo ""
echo "**Release type:** \`${{ inputs.release-type }}\` · **Dist tag:** \`${{ inputs.dist-tag }}\`"
echo ""
echo "### Install"
echo '```bash'
echo "npm install moicle@${{ steps.version.outputs.version }}"
echo '```'
echo ""
if [ -s CHANGES_SECTION.md ]; then
# Drop the duplicated version header line, keep the grouped changes.
tail -n +2 CHANGES_SECTION.md
fi
} > RELEASE_NOTES.md

echo "----- Release notes preview -----"
cat RELEASE_NOTES.md

- name: Publish to NPM
run: |
if [ "${{ inputs.dist-tag }}" == "latest" ]; then
Expand All @@ -112,24 +141,15 @@ jobs:
git push origin ${{ steps.version.outputs.tag }}

- name: Create GitHub Release
uses: actions/create-release@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.tag }}
release_name: Release ${{ steps.version.outputs.version }}
body: |
## 🚀 Release ${{ steps.version.outputs.version }}

**Release Type:** ${{ inputs.release-type }}
**Dist Tag:** ${{ inputs.dist-tag }}

### Installation
```bash
npm install moicle@${{ steps.version.outputs.version }}
```

### Changes
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/master/CHANGELOG.md) for details.
name: Release ${{ steps.version.outputs.version }}
# body_path is prepended; generate_release_notes appends GitHub's
# auto "What's Changed" + contributors list below it.
body_path: RELEASE_NOTES.md
generate_release_notes: true
draft: false
prerelease: ${{ inputs.dist-tag != 'latest' }}
Loading