Skip to content
name: Build and Release Router Binaries
on:
release:
types: [published]
#workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
releases-matrix:
if: startsWith(github.event.release.tag_name, 'router@')
name: Build and Release Router Binaries
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
- goarch: arm64
goos: windows
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: ./.github/actions/go
with:
cache-dependency-path: router/go.sum
- uses: winterjung/split@v2
id: split
with:
separator: "@"
msg: "${{ github.event.release.tag_name }}"
- name: Set BUILD_TIME env
run: echo BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ') >> ${GITHUB_ENV}
- uses: wangyoucao577/go-release-action@v1
name: Build and attach binaries to GitHub Release
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
# Where to run `go build .`
project_path: "router/cmd/router"
binary_name: "router"
pre_command: export CGO_ENABLED=0
build_flags: -trimpath
ldflags: -extldflags -static -X "github.com/wundergraph/cosmo/router/core.Version=${{ steps.split.outputs._1 }}" -X "github.com/wundergraph/cosmo/router/core.Date=${{ env.BUILD_TIME }}" -X "github.com/wundergraph/cosmo/router/core.Commit=${{ github.sha }}"
overwrite: true
extra_files: LICENSE
#release_tag: [email protected]