feature: add multiarch

Signed-off-by: shaowenchen <mail@chenshaowen.com>
This commit is contained in:
shaowenchen 2021-01-07 15:42:50 +08:00
parent 131721e948
commit 31b9cc63f4
4 changed files with 88 additions and 1 deletions

39
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: CI
on:
push:
branches:
- 'master'
- 'release*'
tags:
- 'v*'
pull_request:
branches:
- 'master'
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Build
run: |
make build-multiarch
- uses: actions/upload-artifact@v2
if: github.event_name == 'push'
with:
name: kubeye
path: dist/*.zip

1
.gitignore vendored
View File

@ -36,3 +36,4 @@ Session.vim
# Generate by makefile
bin
dist

41
.goreleaser.yml Normal file
View File

@ -0,0 +1,41 @@
# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
# - go mod tidy
builds:
- env:
# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like Terraform Cloud where
# they are unable to install libraries.
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}}'
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- '386'
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
binary: '{{ .ProjectName }}'
snapshot:
name_template: ""
archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}'
checksum:
name_template: '{{ .ProjectName }}_checksum.txt'
algorithm: sha256
changelog:
skip: true

View File

@ -17,4 +17,10 @@ clean:
# uninstall kubeye from local computer
uninstall:
rm /usr/local/bin/${BINARY} 2> /dev/null
rm /usr/local/bin/${BINARY} 2> /dev/null
install-goreleaser:
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
build-multiarch: install-goreleaser
./bin/goreleaser release --snapshot --skip-publish --rm-dist