-
Notifications
You must be signed in to change notification settings - Fork 107
60 lines (52 loc) · 1.88 KB
/
router-binary-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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]