Updated github workflows. #1
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: 'Version Preview' | ||
| on: | ||
| workflow_call: | ||
| secrets: | ||
| GITHUB_TOKEN: | ||
| required: true | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| jobs: | ||
| preview: | ||
| name: Preview Release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Preview Next Version | ||
| id: preview | ||
| uses: cycjimmy/semantic-release-action@v2 | ||
| with: | ||
| semantic_version: 18.0.0 | ||
| dry_run: true | ||
| branches: | | ||
| [ | ||
| 'main', | ||
| 'master', | ||
| {name: '*', prerelease: true} | ||
| ] | ||
| extra_plugins: | | ||
| @semantic-release/changelog@6.0.0 | ||
| @semantic-release/git@10.0.0 | ||
| conventional-changelog-conventionalcommits@4.6.3 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Comment PR | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const published = '${{ steps.preview.outputs.new_release_published }}'; | ||
| let body = ''; | ||
| if (published === 'true') { | ||
| const releaseType = '${{ steps.preview.outputs.new_release_type }}'; | ||
| const version = '${{ steps.preview.outputs.new_release_version }}'; | ||
| const notes = `${{ steps.preview.outputs.new_release_notes }}`; | ||
| body = `## Release Preview\n\n**Release Type:** \`${releaseType}\`\n**Next Version:** \`${version}\`\n\n### Release Notes\n${notes}`; | ||
| } else { | ||
| body = '## Release Preview\n\nNo new release will be created from this PR.'; | ||
| } | ||
| github.rest.issues.createComment({ | ||
| issue_number: context.issue.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: body | ||
| }); | ||