Skip to content
This repository was archived by the owner on Mar 15, 2024. It is now read-only.

Commit 3e9d428

Browse files
authored
Merge pull request #4 from splunk/mw/github-release
tagged github releases
2 parents 64ca212 + 0deaa98 commit 3e9d428

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

.circleci/config.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848
path: test-results/
4949
- store_artifacts:
5050
path: test-results/
51+
- store_artifacts:
52+
path: /go/bin/vault-plugin-splunk
5153

5254
- save_cache:
5355
name: Saving Cache for vendor
@@ -59,3 +61,38 @@ jobs:
5961
key: build-cache-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_BUILD_NUM }}
6062
paths:
6163
- /tmp/go/cache
64+
65+
- persist_to_workspace:
66+
root: /go/bin
67+
# Must be relative path from root
68+
paths:
69+
- vault-plugin-splunk
70+
71+
publish-github-release:
72+
docker:
73+
- image: cibuilds/github:0.10
74+
steps:
75+
- attach_workspace:
76+
at: ./artifacts
77+
- run:
78+
name: "Publish Release on GitHub"
79+
command: |
80+
VERSION=$(artifacts/vault-plugin-splunk -version)
81+
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./artifacts/
82+
83+
workflows:
84+
version: 2
85+
tagged-build:
86+
jobs:
87+
- build:
88+
filters:
89+
tags:
90+
only: /^\d+\.\d+\.\d+$/
91+
- publish-github-release:
92+
requires:
93+
- build
94+
filters:
95+
branches:
96+
ignore: /.*/
97+
tags:
98+
only: /^\d+\.\d+\.\d+$/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION := 0.1.0
1+
VERSION := $(shell git describe --tags --always 2>/dev/null)
22
SHORT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo dev)
33
GO_VERSION := $(shell go version | awk '{ print $$3}' | sed 's/^go//')
44

cmd/vault-plugin-splunk/main.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"fmt"
45
"os"
56

67
"github.com/hashicorp/go-hclog"
@@ -10,13 +11,26 @@ import (
1011
splunk "github.com/splunk/vault-plugin-splunk"
1112
)
1213

14+
var (
15+
version string
16+
goVersion string
17+
)
18+
1319
func main() {
1420
apiClientMeta := &pluginutil.APIClientMeta{}
1521
flags := apiClientMeta.FlagSet()
22+
printVersion := flags.Bool("version", false, "Prints version")
23+
1624
// all plugins ignore Parse errors
1725
// #nosec G104
1826
flags.Parse(os.Args[1:])
1927

28+
switch {
29+
case *printVersion:
30+
fmt.Printf("%s %s (golang %s)\n", os.Args[0], version, goVersion)
31+
os.Exit(0)
32+
}
33+
2034
tlsConfig := apiClientMeta.GetTLSConfig()
2135
tlsProviderFunc := pluginutil.VaultPluginTLSProvider(tlsConfig)
2236

0 commit comments

Comments
 (0)