Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 40067ca

Browse files
committed
Add circleci config for automatic cross platform github releases
1 parent 785de08 commit 40067ca

5 files changed

Lines changed: 40 additions & 4 deletions

File tree

.circleci/config.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,30 @@ jobs:
2424
- run: go get golang.org/x/tools/cmd/goimports
2525
- run: "! goimports ./... 2>&1 | read"
2626
- run: "! go mod tidy ./... 2>&1 | read"
27+
publish-github-release:
28+
docker:
29+
- image: circleci/golang:1.8
30+
steps:
31+
- checkout
32+
- run: ./buildAll.sh
33+
- run:
34+
command: |
35+
go get github.com/tcnksm/ghr
36+
VERSION=$(`cat VERSION`-`git rev-parse --short HEAD`)
37+
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./bin/
38+
2739
workflows:
2840
version: 2
2941
build:
3042
jobs:
3143
- integration
3244
- unit
3345
- lint
34-
46+
- publish-github-release
47+
requires:
48+
- integration
49+
- unit
50+
- lint
51+
filters:
52+
# branches:
53+
# only: master

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

buildAll.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
export VERSION="`cat VERSION`-`git rev-parse --short HEAD`"
4+
5+
go build -ldflags "-X main.VersionNumber=$VERSION" -o bin/kssh-linux src/cmd/kssh/kssh.go
6+
go build -ldflags "-X main.VersionNumber=$VERSION" -o bin/keybaseca-linux src/cmd/keybaseca/keybaseca.go
7+
8+
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.VersionNumber=$VERSION" -o bin/kssh-mac src/cmd/kssh/kssh.go
9+
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.VersionNumber=$VERSION" -o bin/keybaseca-mac src/cmd/keybaseca/keybaseca.go
10+
11+
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.VersionNumber=$VERSION" -o bin/kssh-windows src/cmd/kssh/kssh.go
12+
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.VersionNumber=$VERSION" -o bin/keybaseca-windows src/cmd/keybaseca/keybaseca.go

src/cmd/keybaseca/keybaseca.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ import (
2626
"github.com/urfave/cli"
2727
)
2828

29+
var VersionNumber = "master"
30+
2931
func main() {
3032
app := cli.NewApp()
3133
app.Name = "keybaseca"
3234
app.Usage = "An SSH CA built on top of Keybase"
33-
app.Version = "0.0.1"
35+
app.Version = VersionNumber
3436
app.Flags = []cli.Flag{
3537
cli.BoolFlag{
3638
Name: "wipe-all-configs",

src/cmd/kssh/kssh.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ var cliArguments = []kssh.CLIArgument{
106106
{Name: "--set-keybase-binary", HasArgument: true},
107107
}
108108

109+
var VersionNumber = "master"
110+
109111
func generateHelpPage() string {
110112
return fmt.Sprintf(`NAME:
111113
kssh - A replacement ssh binary using Keybase SSH CA to provision SSH keys
@@ -114,7 +116,7 @@ USAGE:
114116
kssh [kssh options] [ssh arguments...]
115117
116118
VERSION:
117-
0.0.1
119+
%s
118120
119121
GLOBAL OPTIONS:
120122
--help Show help
@@ -129,7 +131,7 @@ GLOBAL OPTIONS:
129131
--set-default-user Set the default SSH user to be used for kssh. Useful if you use ssh configs that do not set
130132
a default SSH user
131133
--clear-default-user Clear the default SSH user
132-
--set-keybase-binary Run kssh with a specific keybase binary rather than resolving via $PATH `)
134+
--set-keybase-binary Run kssh with a specific keybase binary rather than resolving via $PATH `, VersionNumber)
133135
}
134136

135137
type Action int

0 commit comments

Comments
 (0)