Release #5
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 | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| # Only run on merged PRs or manual dispatch | |
| 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: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🚀 Create Release PR or Release (Automatic) | |
| if: github.event_name == 'pull_request' | |
| id: release | |
| uses: googleapis/release-please-action@v4 | |
| with: | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| - name: 🔧 Setup Node.js (Manual Release) | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: 🚀 Create Manual Release | |
| if: github.event_name == 'workflow_dispatch' | |
| id: manual_release | |
| run: | | |
| npm install -g release-please | |
| release-please release-pr \ | |
| --config-file=release-please-config.json \ | |
| --manifest-file=.release-please-manifest.json \ | |
| --release-as=${{ github.event.inputs.release_type }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set outputs for manual release | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| echo "releases_created=true" >> $GITHUB_OUTPUT | |
| echo "Manual release PR created with type: ${{ github.event.inputs.release_type }}" |