Skip to content

fix: fix customize.ps1 (#2) #2

fix: fix customize.ps1 (#2)

fix: fix customize.ps1 (#2) #2

Workflow file for this run

name: Generate Changelog
on:
push:
branches: [ main ]
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check if cliff.toml exists
id: check_config
run: |
if [ -f "cliff.toml" ]; then
echo "config_exists=true" >> $GITHUB_OUTPUT
else
echo "config_exists=false" >> $GITHUB_OUTPUT
echo "⚠️ cliff.toml not found, skipping changelog generation"
fi
# Use a more recent version or alternative approach
- name: Install git-cliff
if: steps.check_config.outputs.config_exists == 'true'
run: |
# Install git-cliff directly using cargo or from GitHub releases
curl -L https://github.com/orhun/git-cliff/releases/download/v1.4.0/git-cliff-1.4.0-x86_64-unknown-linux-gnu.tar.gz | tar -xz
sudo mv git-cliff-1.4.0/git-cliff /usr/local/bin/
git-cliff --version
- name: Generate changelog
if: steps.check_config.outputs.config_exists == 'true'
id: git-cliff
run: |
# Generate changelog using the installed binary
git-cliff --config cliff.toml --verbose --output CHANGELOG.md
# Set output for use in subsequent steps
if [ -f "CHANGELOG.md" ]; then
echo "content<<EOF" >> $GITHUB_OUTPUT
cat CHANGELOG.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
- name: Commit changelog
if: steps.check_config.outputs.config_exists == 'true' && hashFiles('CHANGELOG.md') != ''
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add CHANGELOG.md
git commit -m "docs: update changelog" || exit 0
git push
# Create release notes for tags
- name: Create Release Notes
if: startsWith(github.ref, 'refs/tags/v') && steps.check_config.outputs.config_exists == 'true'
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.git-cliff.outputs.content }}
draft: false
prerelease: ${{ contains(github.ref, '-dev') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}