-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (71 loc) · 3.07 KB
/
go.yml
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
71
72
name: Go
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ 'created' ]
env:
PROJECT_NAME: l9filter
jobs:
release:
name: Release
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: 'Download Artifact'
uses: actions/download-artifact@v2
with:
name: build
path: bin/
- name: List files
run: |
find ./bin
- name: Release
uses: softprops/action-gh-release@v1
with:
files: bin/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
env:
CGOENABLED: 0
run: |
mkdir bin || true
GOOS=linux GOARCH=386 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-linux-32 -v ./cmd/${PROJECT_NAME}
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-linux-64 -v ./cmd/${PROJECT_NAME}
GOOS=freebsd GOARCH=amd64 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-freebsd-64 -v ./cmd/${PROJECT_NAME}
GOOS=freebsd GOARCH=386 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-freebsd-32 -v ./cmd/${PROJECT_NAME}
GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-linux-arm7 -v ./cmd/${PROJECT_NAME}
GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-linux-arm6 -v ./cmd/${PROJECT_NAME}
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-osx -v ./cmd/${PROJECT_NAME}
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-win64.exe -v ./cmd/${PROJECT_NAME}
GOOS=windows GOARCH=386 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-win32.exe -v ./cmd/${PROJECT_NAME}
GOOS=netbsd GOARCH=amd64 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-netbsd-64 -v ./cmd/${PROJECT_NAME}
GOOS=netbsd GOARCH=386 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-netbsd-32 -v ./cmd/${PROJECT_NAME}
GOOS=openbsd GOARCH=amd64 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-openbsd-64 -v ./cmd/${PROJECT_NAME}
GOOS=openbsd GOARCH=386 go build -ldflags="-s -w -extldflags '-static'" -o bin/${PROJECT_NAME}-openbsd-32 -v ./cmd/${PROJECT_NAME}
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: build
path: bin/