Skip to content

👽️ 增加自动发布 #3

👽️ 增加自动发布

👽️ 增加自动发布 #3

Workflow file for this run

name: Create GitHub Release
on:
push:
tags:
- 'v*.*.*'
jobs:
create_release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Extract version from tag
id: extract_version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Read release notes
id: release_notes
run: |
VERSION=${{ env.VERSION }}
CHANGELOG=$(sed -n "/## $VERSION/,/^## /p" CHANGELOG.md | sed '$d')
if [ -z "$CHANGELOG" ]; then
echo "Release notes not found for version $VERSION"
exit 1
fi
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
body: ${{ env.RELEASE_NOTES }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}