Repository navigation
70 lines (58 loc) · 1.79 KB
/
Copy pathrelease.yml
File metadata and controls
70 lines (58 loc) · 1.79 KB
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
61
62
63
64
65
66
67
68
69
70
name: Go
on:
release:
types: [published]
env:
GOPRIVATE: "github.com"
CGO_ENABLED: "0"
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Define tag
run: |
echo TAG=`echo ${{ github.ref }} | sed "s/refs\/tags\/v//"` >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Configure git for private modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jasperem:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Build Linux
env:
GOOS: "linux"
GOARCH: "amd64"
run: go build -ldflags "-X main.version=${{ env.TAG }}" -o build/otcli_linux cmd/main.go
- name: Build Linux ARM
env:
GOOS: "linux"
GOARCH: "arm"
run: go build -ldflags "-X main.version=${{ env.TAG }}" -o build/otcli_linux_arm cmd/main.go
- name: Build Linux ARM64
env:
GOOS: "linux"
GOARCH: "arm64"
run: go build -ldflags "-X main.version=${{ env.TAG }}" -o build/otcli_linux_arm64 cmd/main.go
- name: Build Mac
env:
GOOS: "darwin"
GOARCH: "amd64"
run: go build -ldflags "-X main.version=${{ env.TAG }}" -o build/otcli_darwin cmd/main.go
- name: Build Windows
env:
GOOS: "windows"
GOARCH: "amd64"
run: go build -ldflags "-X main.version=${{ env.TAG }}" -o build/otcli_windows.exe cmd/main.go
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
build/otcli_linux
build/otcli_linux_arm
build/otcli_linux_arm64
build/otcli_darwin
build/otcli_windows.exe