Add release creation to bump workflow #3
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: Release | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [main, master, latest] | |
| permissions: | |
| contents: write | |
| jobs: | |
| bump: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure git | |
| run: | | |
| git config user.name "Release Otter" | |
| git config user.email "gh@flaticols.dev" | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: stable | |
| - name: Install bump | |
| run: go install github.com/flaticols/bump@latest | |
| - name: Determine version bump | |
| id: bump-type | |
| run: | | |
| if ${{ contains(github.event.pull_request.labels.*.name, 'major') }}; then | |
| echo "type=major" >> $GITHUB_OUTPUT | |
| elif ${{ contains(github.event.pull_request.labels.*.name, 'minor') }}; then | |
| echo "type=minor" >> $GITHUB_OUTPUT | |
| elif ${{ contains(github.event.pull_request.labels.*.name, 'patch') }}; then | |
| echo "type=patch" >> $GITHUB_OUTPUT | |
| else | |
| echo "type=" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Bump version | |
| id: bump | |
| if: steps.bump-type.outputs.type != '' | |
| run: | | |
| bump ${{ steps.bump-type.outputs.type }} --brave | |
| echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release | |
| if: steps.bump.outputs.tag != '' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.bump.outputs.tag }} | |
| generate_release_notes: true |