Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
jobs:
build:
runs-on: ubuntu-20.04

strategy:
fail-fast: true
matrix:
platform: [amd64]

steps:
- uses: actions/checkout@v2

Expand All @@ -20,6 +26,7 @@ jobs:
run: make probe
env:
BUILD_VARIANT: release
BUILD_PLATFORM: ${{ matrix.platform }}

- name: Create Release
id: create_release
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export BUILD_ARCH
export BUILD_BRANCH_NAME := $(or $(BUILD_BRANCH_NAME),$(shell git symbolic-ref --short HEAD 2>/dev/null))
export BUILD_ID
export BUILD_OS := $(or $(BUILD_OS),$(if $(words $(eq $(subst -, ,$(BUILD_VARIANT))),3), $(word 1,$(words $(subst -, ,$(BUILD_VARIANT))))))
export BUILD_REPO_NAME
export BUILD_REVISION_ID
export BUILD_SHORT_SHA := $(or $(BUILD_SHORT_SHA),$(shell git describe --match="" --always --abbrev --dirty 2>/dev/null))
Expand Down
8 changes: 5 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
function buildRelease {
for target in "$@"; do
set -x
CGO_ENABLED=0 GOOS=linux go build -v \
CGO_ENABLED=0 GOOS=${build_os} GOARCH=${build_arch} go build -v \
-ldflags='-s -w -extldflags "-static" -X github.com/taisph/go_common/pkg/commonlog.BasePath='${base_path}/' -X github.com/taisph/go_common/pkg/commonversion.Version='${version}' -X github.com/taisph/go_common/pkg/commonversion.Branch='${branch_name}'' \
-o ${build_output}/${target##*/} ${target}
set +x
Expand All @@ -15,7 +15,7 @@ function buildRelease {
function buildDebug {
for target in "$@"; do
set -x
CGO_ENABLED=0 GOOS=linux go build -v \
CGO_ENABLED=0 GOOS=${build_os:-$(go env GOOS)} GOARCH=${build_arch:-$(go env GOARCH)} go build -v \
-ldflags='-extldflags "-static" -X github.com/taisph/go_common/pkg/commonlog.BasePath='${base_path}/' -X github.com/taisph/go_common/pkg/commonversion.Version='${version}' -X github.com/taisph/go_common/pkg/commonversion.Branch='${branch_name}'' \
-o ${build_output}/${target##*/} ${target}
set +x
Expand All @@ -25,8 +25,10 @@ function buildDebug {
base_path="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
version=${BUILD_VERSION}
branch_name=${BUILD_BRANCH_NAME}
build_variant=${BUILD_VARIANT}
build_arch=${BUILD_ARCH:-}
build_os=${BUILD_OS:-}
build_output=out
build_variant=${BUILD_VARIANT}
targets="$*"

# Sanity checks.
Expand Down