-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
33 lines (33 loc) · 1.09 KB
/
playbook.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
- hosts: localhost
vars:
OSARCHs:
-
GOOS: linux
GOARCH: arm
CC: arm-linux-musleabihf-gcc
-
GOOS: linux
GOARCH: amd64
CC: x86_64-linux-musl-gcc
tasks:
- name: Get git rev version
local_action: command git rev-parse --short HEAD
register: GIT_COMMIT_ID
- name: Build
vars:
- BUILD_TIME: "{{ansible_date_time.iso8601}}"
- GIT_TAG: "{{GIT_COMMIT_ID.stdout}}"
- LDFLAGS: -ldflags "-X 'wfRadius/util.GitTag={{GIT_TAG}}' -X 'wfRadius/util.BuildTime={{BUILD_TIME}}'"
environment:
GOOS: "{{item.GOOS}}"
GOARCH: "{{item.GOARCH}}"
CC: "{{item.CC}}"
CGO_LDFLAGS: "-static -w -s"
CGO_ENABLED: 1
local_action: command go build -a -o dist/wfRadius_{{item.GOOS}}_{{item.GOARCH}} {{LDFLAGS}}
with_items: "{{OSARCHs}}"
- name: Upload
local_action: command curl https://afile.atsuas.cn/api/file/upload -F "file=@dist/wfRadius_{{item.GOOS}}_{{item.GOARCH}}"
with_items: "{{OSARCHs}}"
- name: Say done
local_action: command say done