fix(release): Fix YAML syntax error at line 78 #12
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: Create Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., 1.4.0)' | |
| required: true | |
| type: string | |
| use_existing_changelog: | |
| description: 'Use existing CHANGELOG_{VERSION}.md file instead of generating one' | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| name: Create GitHub Release | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| else | |
| # Extract version from tag (e.g., v1.4.0 -> 1.4.0) | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Check for existing changelog | |
| id: changelog_check | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| CHANGELOG_FILE="CHANGELOG_${VERSION}.md" | |
| if [ "${{ github.event.inputs.use_existing_changelog }}" = "true" ] && [ -f "$CHANGELOG_FILE" ]; then | |
| echo "changelog_exists=true" >> $GITHUB_OUTPUT | |
| echo "Using existing changelog: $CHANGELOG_FILE" | |
| elif [ -f "$CHANGELOG_FILE" ]; then | |
| echo "changelog_exists=false" >> $GITHUB_OUTPUT | |
| echo "Changelog file exists but use_existing_changelog is false" | |
| else | |
| echo "changelog_exists=false" >> $GITHUB_OUTPUT | |
| echo "No changelog file found, will generate with git-cliff" | |
| - name: Generate changelog with git-cliff | |
| if: steps.changelog_check.outputs.changelog_exists == 'false' | |
| uses: orhun/git-cliff-action@v2 | |
| with: | |
| config: cliff.toml | |
| output: CHANGELOG.md | |
| tag: ${{ steps.version.outputs.version }} | |
| args: --verbose | |
| - name: Format generated changelog | |
| if: steps.changelog_check.outputs.changelog_exists == 'false' | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| # Add version header to generated changelog | |
| echo "# Changelog - Version $VERSION" > CHANGELOG_temp.md | |
| echo "" >> CHANGELOG_temp.md | |
| echo "*This changelog was automatically generated using git-cliff*" >> CHANGELOG_temp.md | |
| echo "" >> CHANGELOG_temp.md | |
| # Append generated changelog | |
| cat CHANGELOG.md >> CHANGELOG_temp.md | |
| # Replace temp file | |
| mv CHANGELOG_temp.md CHANGELOG.md | |
| # Create versioned changelog | |
| cp CHANGELOG.md "CHANGELOG_${VERSION}.md" | |
| - name: Create release notes | |
| id: release_notes | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| if [ "${{ steps.changelog_check.outputs.changelog_exists }}" = "true" ]; then | |
| CHANGELOG_FILE="CHANGELOG_${VERSION}.md" | |
| # Use existing changelog | |
| echo "### Release $VERSION" > release_notes.md | |
| echo "" >> release_notes.md | |
| echo "*Using existing \`$CHANGELOG_FILE\`*" >> release_notes.md | |
| echo "" >> release_notes.md | |
| # Add changelog content | |
| cat "$CHANGELOG_FILE" >> release_notes.md | |
| else | |
| # Use git-cliff generated changelog | |
| echo "### Release $VERSION" > release_notes.md | |
| echo "" >> release_notes.md | |
| echo "*Automatically generated using git-cliff*" >> release_notes.md | |
| echo "" >> release_notes.md | |
| # Append generated changelog (without header we added) | |
| tail -n +2 CHANGELOG.md >> release_notes.md | |
| fi | |
| echo "notes_file=release_notes.md" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| NOTES_FILE="${{ steps.release_notes.outputs.notes_file }}" | |
| # Create release using GitHub CLI | |
| gh release create "v${VERSION}" \ | |
| --title "v${VERSION}" \ | |
| --notes-file "$NOTES_FILE" \ | |
| --repo "$GITHUB_REPOSITORY" | |
| - name: Commit new changelog if generated | |
| if: steps.changelog_check.outputs.changelog_exists == 'false' | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| message: 'chore: Generate changelog for v${{ steps.version.outputs.version }} [skip ci]' | |
| add: '.' | |
| path: 'CHANGELOG_${{ steps.version.outputs.version }}.md' | |
| - name: Upload changelog artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: changelog-${{ steps.version.outputs.version }} | |
| path: | | |
| CHANGELOG_${{ steps.version.outputs.version }}.md | |
| CHANGELOG.md | |
| release_notes.md |