fix: address cd.yml workflow issues #11
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Continuous Deployment | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| release: | ||
| types: [published] | ||
| jobs: | ||
| generate-changelog: | ||
| name: Generate changelog | ||
| runs-on: ubuntu-22.04 | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| outputs: | ||
| release_body: ${{ steps.git-cliff-latest.outputs.content }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Generate latest changelog for release | ||
| uses: orhun/git-cliff-action@v4 | ||
| id: git-cliff-latest | ||
| with: | ||
| config: pyproject.toml | ||
| args: -vv --latest --strip header | ||
| env: | ||
| GITHUB_REPO: ${{ github.repository }} | ||
| - name: Fetch latest main | ||
| run: git fetch origin main | ||
| - name: Create worktree for changelog | ||
| run: git worktree add worktree-changelog origin/main | ||
| - name: Generate full changelog in worktree | ||
| working-directory: worktree-changelog | ||
| uses: orhun/git-cliff-action@v4 | ||
| with: | ||
| config: pyproject.toml | ||
| args: -vv | ||
| env: | ||
| OUTPUT: docs/changelog.rst | ||
| GITHUB_REPO: ${{ github.repository }} | ||
| - name: Create PR with changelog updates | ||
| working-directory: worktree-changelog | ||
| run: | | ||
| git config user.name 'github-actions[bot]' | ||
| git config user.email 'github-actions[bot]@users.noreply.github.com' | ||
| git add docs/changelog.rst | ||
| if git diff --staged --quiet; then | ||
| echo "No changes to commit" | ||
| else | ||
| # Create unique branch name | ||
| BRANCH_NAME="changelog/update-$(git rev-parse --short HEAD)" | ||
| git checkout -b "$BRANCH_NAME" | ||
| # Commit with Claude Code signature | ||
| git commit -m "docs: update changelog" \ | ||
| -m "🤖 Generated with [Claude Code](https://claude.com/claude-code)" \ | ||
| -m "Co-Authored-By: Claude <noreply@anthropic.com>" | ||
| # Push and create PR | ||
| git push origin "$BRANCH_NAME" | ||
| gh pr create \ | ||
| --base main \ | ||
| --head "$BRANCH_NAME" \ | ||
| --title "docs: update changelog" \ | ||
| --body "Automated changelog update generated by git-cliff. | ||
| This PR updates the changelog with the latest commits. | ||
| 🤖 Generated with [Claude Code](https://claude.com/claude-code)" \ | ||
| --label "documentation" \ | ||
| --label "automated" | ||
| fi | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| - name: Update GitHub release body | ||
| if: github.event_name == 'release' | ||
| run: | | ||
| # Update release body with latest changelog | ||
| gh release edit "${{ github.event.release.tag_name }}" \ | ||
| --notes "${{ steps.git-cliff-latest.outputs.content }}" \ | ||
| --repo ${{ github.repository }} | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| - name: Cleanup worktree | ||
| if: always() | ||
| run: git worktree remove worktree-changelog || true | ||