Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
embed the os and architecture in build. specify the version in outpu …
Browse files Browse the repository at this point in the history
…artifacts.
  • Loading branch information
AnalogJ committed Jul 30, 2017
1 parent abb8c31 commit 307e377
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
10 changes: 7 additions & 3 deletions capsule.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
---
engine_enable_code_mutation: true
engine_cmd_compile: 'go build -tags "static" $(go list ./cmd/...)'
engine_cmd_compile:
- 'source /scripts/toolchains/linux/linux-build-env.sh && go build -o capsulecd-linux-amd64 -tags "static" $(go list ./cmd/...)'
- 'source /scripts/toolchains/osx/osx-build-env.sh && go build -o capsulecd-darwin-amd64 -tags "static" $(go list ./cmd/...)'
engine_cmd_test: 'go test -v -tags "static" $(glide novendor)'
engine_cmd_lint: 'gometalinter.v1 --vendor --config=gometalinter.json ./...'
scm_enable_branch_cleanup: true
scm_release_assets:
- local_path: capsulecd
artifact_name: capsulecd
- local_path: capsulecd-linux-amd64
artifact_name: capsulecd-linux-amd64
- local_path: capsulecd-darwin-amd64
artifact_name: capsulecd-darwin-amd64
dependencies_step:
post:
- mkdir -p vendor/gopkg.in/libgit2/git2go.v25/vendor/libgit2/build/
Expand Down
2 changes: 1 addition & 1 deletion ci/capsulecd.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# retrieve the latest capsulecd release info
asset_url=$(curl -s https://api.github.com/repos/AnalogJ/capsulecd/releases/latest \
| grep browser_download_url | grep 'capsulecd' | cut -d '"' -f 4)
| grep browser_download_url | grep 'capsulecd-linux' | cut -d '"' -f 4)

# download the capsulecd asset here.
curl -L -o capsulecd $asset_url
Expand Down
13 changes: 12 additions & 1 deletion cmd/capsulecd/capsulecd.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,18 @@ func main() {
Before: func(c *cli.Context) error {

capsuleUrl := "https://www.capsulecd.com"
versionInfo := fmt.Sprintf("%s-%s", "linux", version.VERSION)

goos := os.Getenv("GOOS")
goarch := os.Getenv("GOARCH")

if(goos == ""){
goos = "linux"
}
if(goarch == ""){
goarch = "amd64"
}

versionInfo := fmt.Sprintf("%s.%s-%s", goos, goarch, version.VERSION)

subtitle := capsuleUrl + utils.LeftPad2Len(versionInfo, " ", 53-len(capsuleUrl))

Expand Down

0 comments on commit 307e377

Please sign in to comment.