Release #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
| # .github/workflows/release.yml | |
| name: Release | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: [closed] | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Type of release' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| prerelease: | |
| description: 'Mark as prerelease' | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true) | |
| outputs: | |
| releases_created: ${{ steps.release.outputs.releases_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - name: 🚀 Create Release PR or Release (Auto) | |
| if: github.event_name == 'pull_request' | |
| id: release_auto | |
| uses: google-github-actions/release-please-action@v4 | |
| with: | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| - name: 🚀 Create Release PR or Release (Manual) | |
| if: github.event_name == 'workflow_dispatch' | |
| id: release_manual | |
| uses: google-github-actions/release-please-action@v4 | |
| with: | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| release-type: ${{ github.event.inputs.release_type }} | |
| prerelease: ${{ github.event.inputs.prerelease }} | |
| - name: Set outputs | |
| id: release | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| echo "releases_created=${{ steps.release_manual.outputs.releases_created }}" >> $GITHUB_OUTPUT | |
| echo "tag_name=${{ steps.release_manual.outputs.tag_name }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "releases_created=${{ steps.release_auto.outputs.releases_created }}" >> $GITHUB_OUTPUT | |
| echo "tag_name=${{ steps.release_auto.outputs.tag_name }}" >> $GITHUB_OUTPUT | |
| fi |