Update action.yml #4
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: Release Actions | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'info/**' | |
| - 'build/**' | |
| - 'create-pr/**' | |
| - 'release/**' | |
| - 'message/**' | |
| - 'README.md' | |
| - 'docs/**' | |
| - '.github/workflows/release.yml' | |
| workflow_dispatch: | |
| jobs: | |
| release: | |
| name: Publish release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine version | |
| id: tag | |
| uses: anothrNick/github-tag-action@1.67.0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| WITH_V: false | |
| DEFAULT_BUMP: patch | |
| RELEASE_BRANCHES: main | |
| - name: Generate release notes | |
| id: notes | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const newTag = '${{ steps.tag.outputs.new_tag }}'; | |
| const { data: tags } = await github.rest.repos.listTags({ owner, repo, per_page: 1 }); | |
| const previousTag = tags.length > 0 ? tags[0].name : undefined; | |
| const { data: notes } = await github.rest.repos.generateReleaseNotes({ | |
| owner, | |
| repo, | |
| tag_name: newTag, | |
| target_commitish: context.sha, | |
| previous_tag_name: previousTag | |
| }); | |
| core.setOutput('notes', notes?.body ?? 'Automated release'); | |
| result-encoding: string | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.new_tag }} | |
| name: ${{ steps.tag.outputs.new_tag }} | |
| body: ${{ steps.notes.outputs.notes }} | |
| generate_release_notes: false |