Release: Please #3
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: | |
| - 'release/**' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version (e.g., 0.3.0)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Determine version and branch | |
| id: vars | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| VERSION="${{ inputs.version }}" | |
| BRANCH="release/v${{ inputs.version }}" | |
| else | |
| VERSION="${GITHUB_REF_NAME#release/v}" | |
| BRANCH="${GITHUB_REF_NAME}" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "branch=$BRANCH" >> $GITHUB_OUTPUT | |
| echo "Version: $VERSION, Branch: $BRANCH" | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ steps.vars.outputs.branch }} | |
| - name: Set release-as version | |
| run: | | |
| jq --arg version "${{ steps.vars.outputs.version }}" \ | |
| '.packages["."]["release-as"] = $version' \ | |
| .github/release-please-config.json > tmp.json && mv tmp.json .github/release-please-config.json | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| token: ${{ secrets.RELEASE_PAT }} | |
| config-file: .github/release-please-config.json | |
| manifest-file: .github/.release-please-manifest.json | |
| target-branch: ${{ steps.vars.outputs.branch }} |