Skip to content

Commit

Permalink
fix: update and fix some changelog yml bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
erfjab committed Oct 31, 2024
1 parent 27e5b6f commit 7f951ae
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
name: Generate Changelog
name: Update Changelog

on:
workflow_dispatch:
push:
tags: ['v*']
release:
types: [published]

jobs:
generate-changelog:
update-changelog:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 0

- name: Generate Changelog
id: changelog
run: |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD)
git log ${PREVIOUS_TAG}..HEAD --pretty=format:"- %s" > CHANGELOG.md
git log ${PREVIOUS_TAG}..HEAD --pretty=format:"- %s" >> CHANGELOG.md
- name: Commit Changelog
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add CHANGELOG.md
git commit -m "docs: update changelog" || echo "No changes to commit"
git push origin HEAD:master
git push origin master
- name: Create GitHub Release
- name: Create or Update Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: CHANGELOG.md
draft: false
prerelease: false
prerelease: false
tag_name: ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 7f951ae

Please sign in to comment.