Merge pull request #12 from GonkaGate/release-please--branches--main-… #21
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 Please | |
| on: | |
| push: | |
| branches: [main] | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| inputs: | |
| action: | |
| description: What to do (check verifies OIDC without publishing) | |
| required: true | |
| type: choice | |
| default: check | |
| options: | |
| - check | |
| - publish | |
| publish_ref: | |
| description: Git ref to publish (for example tag v0.2.2). Leave empty to publish the workflow ref. | |
| required: false | |
| type: string | |
| default: "" | |
| permissions: | |
| contents: write | |
| id-token: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0 | |
| id: release | |
| with: | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| # npm trusted publishing validates the calling workflow name for | |
| # workflow_dispatch/workflow_call flows, so release-please.yml must remain the | |
| # top-level entrypoint for both automatic and manual publish paths. | |
| publish-release: | |
| if: needs.release-please.outputs.release_created == 'true' | |
| needs: | |
| - release-please | |
| permissions: | |
| contents: read | |
| id-token: write | |
| uses: ./.github/workflows/publish.yml | |
| with: | |
| action: publish | |
| publish_ref: ${{ needs.release-please.outputs.tag_name }} | |
| publish-manual-or-tag: | |
| if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: read | |
| id-token: write | |
| uses: ./.github/workflows/publish.yml | |
| with: | |
| action: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.action || 'publish' }} | |
| publish_ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.publish_ref != '' && github.event.inputs.publish_ref || github.ref }} |