chore(runtime): Update release-please workflow to use dedicated token… #26
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: Test and Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| actions: read | |
| checks: write | |
| env: | |
| PROTOC_VERSION: "33.0" | |
| jobs: | |
| lint: | |
| if: "!contains(github.event.head_commit.message, 'chore(main)')" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: '^1.23.0' | |
| test: | |
| if: "!contains(github.event.head_commit.message, 'chore(main)')" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| actions: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: '^1.23.0' # The Go version to download (if necessary) and use. | |
| - name: Install unzip (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y unzip | |
| - name: Download protoc (Linux example) | |
| if: runner.os == 'Linux' | |
| run: | | |
| PROTOC_ZIP=protoc-${{ env.PROTOC_VERSION }}-linux-x86_64.zip | |
| curl -sSL -o /tmp/$PROTOC_ZIP https://github.com/protocolbuffers/protobuf/releases/download/v${{ env.PROTOC_VERSION }}/$PROTOC_ZIP | |
| sudo unzip -o /tmp/$PROTOC_ZIP -d /usr/local | |
| sudo chmod +x /usr/local/bin/protoc | |
| - name: Download protoc (macOS example) | |
| if: runner.os == 'macOS' | |
| run: | | |
| PROTOC_ZIP=protoc-${{ env.PROTOC_VERSION }}-osx-x86_64.zip | |
| curl -sSL -o /tmp/$PROTOC_ZIP https://github.com/protocolbuffers/protobuf/releases/download/v${{ env.PROTOC_VERSION }}/$PROTOC_ZIP | |
| sudo unzip -o /tmp/$PROTOC_ZIP -d /usr/local | |
| sudo chmod +x /usr/local/bin/protoc | |
| - name: Download protoc (Windows example) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $ver = "${{ env.PROTOC_VERSION }}" | |
| $zip = "protoc-$ver-win64.zip" | |
| Invoke-WebRequest -Uri "https://github.com/protocolbuffers/protobuf/releases/download/v$ver/$zip" -OutFile "$env:TEMP\$zip" | |
| Expand-Archive -Path "$env:TEMP\$zip" -DestinationPath "$env:ProgramFiles" | |
| $env:PATH += ";" + "$env:ProgramFiles\bin" | |
| - name: Verify protoc version | |
| run: protoc --version | |
| - name: Install Tools and Protoc Plugins via Makefile | |
| run: make init | |
| - name: Run tests | |
| run: make test | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: '^1.23.0' | |
| - name: Create Release and Changelog | |
| id: release | |
| uses: googleapis/release-please-action@v4 | |
| with: | |
| config-file: release-please-config.json | |
| manifest-file: .github/.release-please-manifest.json | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Tools and Protoc Plugins via Makefile | |
| if: ${{ steps.release.outputs.release_created }} | |
| run: make init | |
| - name: Push to Buf Schema Registry | |
| if: ${{ steps.release.outputs.release_created }} | |
| env: | |
| BUF_TOKEN: ${{ secrets.BUF_TOKEN }} | |
| run: | | |
| buf push | |
| buf push --label ${{ steps.release.outputs.tag_name }} | |
| - name: Notify on new release | |
| if: ${{ steps.release.outputs.release_created }} | |
| run: | | |
| echo "New release created: ${{ steps.release.outputs.tag_name }}" | |
| echo "Release notes: ${{ steps.release.outputs.release_notes }}" |