Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
Signed-off-by: storyicon <yuanchao@bilibili.com>
  • Loading branch information
storyicon committed Jul 20, 2021
0 parents commit 9aac714
Show file tree
Hide file tree
Showing 47 changed files with 5,480 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Go

on:
push:
tags: [ '**' ]
pull_request:
tags: [ '**' ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Build
run: make build

- name: Release
uses: fnkr/github-action-ghr@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GHR_COMPRESS: gz
GHR_PATH: /home/runner/work/powerproto/powerproto/dist/
GITHUB_TOKEN: ${{ secrets.ACTIONS_SECRET }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vscode
.idea
dist
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
VERSION=$(shell git describe --tags)
GIT_REVISION=$(shell git rev-parse --short HEAD)
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
BUILD_DATE=$$(date +%Y-%m-%d-%H:%M)
GO_FLAGS := -ldflags "-X main.BuildDate=$(BUILD_DATE) -X main.Branch=$(GIT_BRANCH) -X main.Revision=$(GIT_REVISION) -X main.Version=$(VERSION) -extldflags \"-static\" -s -w" -tags netgo

# Generate binaries for a powerproto release
.PHONY: build
build:
rm -fr ./dist/
mkdir -p ./dist
GOOS="linux" GOARCH="amd64" CGO_ENABLED=0 go build $(GO_FLAGS) -o ./dist/powerproto-linux-amd64 ./cmd/powerproto
GOOS="linux" GOARCH="arm64" CGO_ENABLED=0 go build $(GO_FLAGS) -o ./dist/powerproto-linux-arm64 ./cmd/powerproto
GOOS="linux" GOARCH="arm" CGO_ENABLED=0 go build $(GO_FLAGS) -o ./dist/powerproto-linux-arm ./cmd/powerproto
GOOS="linux" GOARCH="386" CGO_ENABLED=0 go build $(GO_FLAGS) -o ./dist/powerproto-linux-x86 ./cmd/powerproto
GOOS="windows" GOARCH="386" CGO_ENABLED=0 go build $(GO_FLAGS) -o ./dist/powerproto-windows-x86.exe ./cmd/powerproto
GOOS="windows" GOARCH="amd64" CGO_ENABLED=0 go build $(GO_FLAGS) -o ./dist/powerproto-windows-amd64.exe ./cmd/powerproto
GOOS="darwin" GOARCH="amd64" CGO_ENABLED=0 go build $(GO_FLAGS) -o ./dist/powerproto-darwin-amd64 ./cmd/powerproto
GOOS="darwin" GOARCH="arm64" CGO_ENABLED=0 go build $(GO_FLAGS) -o ./dist/powerproto-darwin-arm64 ./cmd/powerproto
Loading

0 comments on commit 9aac714

Please sign in to comment.