This repository has been archived by the owner on Sep 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci,version: add statically linked versioned binary
The release binaries are also uploaded to GitHub releases page.
- Loading branch information
Alex Vaghin
committed
Sep 20, 2016
1 parent
632f1d9
commit 848fc1f
Showing
5 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.SytNdB4wH1wYUiVY5gORAvJCiHovYJ0mlnPCwYv6ClytsRuZkJZsVW5PTkSMH7Xt4idQATISPvagxZaizxYme-bAgJqsoERzvQV3g4l5NrwbI2AR0zZr2ZXWoqEa-LiuRfFNeAAaY8xhtFjmOlL-aNcfR8nDgJQLD9Lhs2VPCdTdrqYGrIYvASo-lVkzhhBSD8DzPx8qIHEUsp_3QtFWLYa-X3C-eWBgefF0fN7nz_SqrHyT82YXX1uCc9qCQx3dlSxYUSNBU6UMiTnF-mwykDC0GoVcQ3RImDHCIrafNAneAC5QgpgDzS9uK0liw28mAaPVdBIISEdvlUYmBfystg.-hI9dcTpYd9mIaly.KlOqcJAceQ4KfhzagQvf9andq6KF_vh1reYM3OgHNEJB5DRexGAVd9LY_X81Wiynv-d5ZSFeGm2PbWne9LtlOW-R8bakf-H-9oL1HqgCMKgDt5qrl08LiFjBBWr7m6HWcEW7ZRLj-pVUuwpltfhxBrHXcNzekaaMTn9cstXBPhPHdEI6ZMZF6T0n992CXZE.zOUAbIwC29tgYOofC8GwRg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
.drone.sec.yml | ||
*.pem | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2016 Google Inc. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
RELEASES=bin/acme-darwin-amd64 \ | ||
bin/acme-linux-amd64 \ | ||
bin/acme-linux-386 \ | ||
bin/acme-linux-arm \ | ||
bin/acme-windows-amd64.exe \ | ||
bin/acme-windows-386.exe | ||
|
||
all: $(RELEASES) | ||
|
||
bin/acme-%: GOOS=$(firstword $(subst -, ,$*)) | ||
bin/acme-%: GOARCH=$(subst .exe,,$(word 2,$(subst -, ,$*))) | ||
bin/acme-%: $(wildcard *.go) | ||
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build \ | ||
-ldflags "-X main.osarch=$(GOOS)/$(GOARCH) -s -w" \ | ||
-buildmode=exe \ | ||
-tags release \ | ||
-o $@ | ||
|
||
clean: | ||
rm -rf bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2015 Google Inc. All Rights Reserved. | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// +build release | ||
|
||
package main | ||
|
||
import "fmt" | ||
|
||
var ( | ||
version = "1.0.0" | ||
osarch string // set by ldflags | ||
|
||
cmdVersion = &command{ | ||
run: runVersion, | ||
UsageLine: "version", | ||
Short: "display acme tool version", | ||
Long: ` | ||
The version command is available only for releases. | ||
The binary built with "go get" will not have the version subcommand. | ||
`, | ||
} | ||
) | ||
|
||
func init() { | ||
// Insert "acme version" at the top of the commands. | ||
commands = append([]*command{cmdVersion}, commands...) | ||
} | ||
|
||
func runVersion(args []string) { | ||
fmt.Println(version, osarch) | ||
} |