ci: use go-only buf template in release workflow #3
Workflow file for this run
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 | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.os }}-${{ matrix.arch }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - os: darwin | |
| arch: arm64 | |
| - os: darwin | |
| arch: amd64 | |
| - os: linux | |
| arch: amd64 | |
| - os: linux | |
| arch: arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: agentanycast/agentanycast | |
| path: agentanycast-main | |
| sparse-checkout: proto | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: AgentAnycast/agentanycast-identity | |
| path: agentanycast-identity | |
| - uses: bufbuild/buf-setup-action@v1 | |
| with: | |
| github_token: ${{ github.token }} | |
| - name: Generate Go code from proto | |
| working-directory: agentanycast-main/proto | |
| run: | | |
| printf 'version: v2\nplugins:\n - remote: buf.build/protocolbuffers/go\n out: gen/go\n opt: paths=source_relative\n - remote: buf.build/grpc/go\n out: gen/go\n opt: paths=source_relative\n' > buf.gen.go-only.yaml | |
| buf generate --template buf.gen.go-only.yaml | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Configure local replace directives | |
| run: | | |
| go mod edit -replace github.com/agentanycast/agentanycast-proto=./agentanycast-main/proto | |
| go mod edit -replace github.com/AgentAnycast/agentanycast-identity=./agentanycast-identity | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Build binary | |
| env: | |
| CGO_ENABLED: "0" | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: go build -trimpath -ldflags="-s -w -X main.version=${{ github.ref_name }}" -o agentanycastd-${{ matrix.os }}-${{ matrix.arch }} ./cmd/agentanycastd | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agentanycastd-${{ matrix.os }}-${{ matrix.arch }} | |
| path: agentanycastd-${{ matrix.os }}-${{ matrix.arch }} | |
| retention-days: 1 | |
| release: | |
| name: Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: agentanycast/agentanycast | |
| path: agentanycast-main | |
| sparse-checkout: proto | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: AgentAnycast/agentanycast-identity | |
| path: agentanycast-identity | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Configure local replace directives | |
| run: | | |
| go mod edit -replace github.com/agentanycast/agentanycast-proto=./agentanycast-main/proto | |
| go mod edit -replace github.com/AgentAnycast/agentanycast-identity=./agentanycast-identity | |
| - name: Generate SBOM | |
| run: | | |
| go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@latest | |
| cyclonedx-gomod mod -json -output sbom.cdx.json | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Generate checksums | |
| working-directory: artifacts | |
| run: sha256sum agentanycastd-* > checksums.txt | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: | | |
| artifacts/agentanycastd-* | |
| artifacts/checksums.txt | |
| sbom.cdx.json |