发布添加更新说明

This commit is contained in:
Cp0204 2024-09-01 22:44:59 +08:00
parent f818efb4c2
commit 8c85141e7a

View File

@ -1,7 +1,7 @@
name: Docker Publish
permissions:
contents: read
contents: write
packages: write
on:
@ -21,6 +21,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract metadata (tags, labels) for Docker
id: meta
@ -84,9 +86,38 @@ jobs:
- name: Update repo description
uses: peter-evans/dockerhub-description@v4
if: startsWith(github.ref, 'refs/tags/')
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.IMAGE_NAME }}
short-description: ${{ github.event.repository.description }}
enable-url-completion: true
enable-url-completion: true
- name: Get Commit Messages
id: get_commit_messages
run: |
# Get the latest tag
LATEST_TAG=$(git describe --tags --abbrev=0 HEAD^)
# If there is no latest tag, get only the latest commit message
if [ -z "$LATEST_TAG" ]; then
COMMITS=$(git log -1 --pretty=format:'- %s (%h)')
else
COMMITS=$(git log --pretty=format:'- %s (%h)' --no-merges "$LATEST_TAG"..HEAD)
fi
# Output Multi-Line String
echo "commits<<EOF" >> $GITHUB_OUTPUT
echo "$COMMITS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Upload New Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: false
prerelease: false
body: "## What's Changed\n\n${{ steps.get_commit_messages.outputs.commits }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}