Use goxzst for release

This commit is contained in:
Hidetake Iwata
2019-04-05 09:58:34 +09:00
parent 15d40413e4
commit 89a1046ce3
5 changed files with 24 additions and 34 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
curl -L -o ~/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
chmod +x ~/bin/kubectl
- run: go get golang.org/x/lint/golint
- run: go get github.com/mitchellh/gox
- run: go get github.com/int128/goxzst
- run: go get github.com/tcnksm/ghr
- run: go get github.com/Songmu/ghch/cmd/ghch
- run: go get github.com/int128/ghcp
+2
View File
@@ -1,3 +1,5 @@
/.idea
/dist
/kubelogin
/kubectl-oidc_login
/.kubeconfig
+17 -22
View File
@@ -1,11 +1,11 @@
TARGET := kubelogin
TARGET_PLUGIN := kubectl-oidc_login
OSARCH := darwin/amd64 linux/amd64 windows/amd64
CIRCLE_TAG ?= snapshot
CIRCLE_TAG ?= HEAD
LDFLAGS := -X main.version=$(CIRCLE_TAG)
.PHONY: check run release_bin release_homebrew release clean
.PHONY: check run release clean
all: dist/$(TARGET)
all: $(TARGET)
check:
golint
@@ -13,29 +13,24 @@ check:
$(MAKE) -C cli_test/authserver/testdata
go test -v ./...
dist/$(TARGET): $(wildcard *.go)
go build -o $@ -ldflags '-X main.version=$(CIRCLE_TAG)'
$(TARGET): $(wildcard *.go)
go build -o $@ -ldflags "$(LDFLAGS)"
dist/$(TARGET_PLUGIN): dist/$(TARGET)
ln -s $(TARGET) $@
$(TARGET_PLUGIN): $(TARGET)
ln -sf $(TARGET) $@
run: dist/$(TARGET_PLUGIN)
-PATH=dist:$(PATH) kubectl oidc-login --help
run: $(TARGET_PLUGIN)
-PATH=.:$(PATH) kubectl oidc-login --help
dist/bin:
gox --osarch '$(OSARCH)' -output 'dist/bin/$(TARGET)_{{.OS}}_{{.Arch}}'
cd dist/bin && shasum -a 256 -b * > $(TARGET)_checksums.txt
dist:
VERSION=$(CIRCLE_TAG) goxzst -d dist/gh/ -o "$(TARGET)" -t "kubelogin.rb" -- -ldflags "$(LDFLAGS)"
mv dist/gh/kubelogin.rb dist/
release_bin: dist/bin
ghr -u "$(CIRCLE_PROJECT_USERNAME)" -r "$(CIRCLE_PROJECT_REPONAME)" -b "$$(ghch -F markdown --latest)" "$(CIRCLE_TAG)" dist/bin
dist/kubelogin.rb: dist/bin
./homebrew.sh dist/bin/$(TARGET)_darwin_amd64 > dist/kubelogin.rb
release_homebrew: dist/kubelogin.rb
release: dist
ghr -u "$(CIRCLE_PROJECT_USERNAME)" -r "$(CIRCLE_PROJECT_REPONAME)" -b "$$(ghch -F markdown --latest)" "$(CIRCLE_TAG)" dist/gh/
ghcp -u "$(CIRCLE_PROJECT_USERNAME)" -r "homebrew-$(CIRCLE_PROJECT_REPONAME)" -m "$(CIRCLE_TAG)" -C dist/ kubelogin.rb
release: release_bin release_homebrew
clean:
-rm $(TARGET)
-rm $(TARGET_PLUGIN)
-rm -r dist/
Executable → Regular
+3 -10
View File
@@ -1,15 +1,9 @@
#!/bin/bash -xe
dist_bin="$1"
dist_sha256=$(shasum -a 256 -b "$dist_bin" | cut -f1 -d' ')
cat <<EOF
class Kubelogin < Formula
desc "A kubectl plugin for Kubernetes OpenID Connect authentication"
homepage "https://github.com/int128/kubelogin"
url "https://github.com/int128/kubelogin/releases/download/${CIRCLE_TAG}/kubelogin_darwin_amd64"
version "${CIRCLE_TAG}"
sha256 "${dist_sha256}"
url "https://github.com/int128/kubelogin/releases/download/{{ env "VERSION" }}/kubelogin_darwin_amd64.zip"
version "{{ env "VERSION" }}"
sha256 "{{ .darwin_amd64_zip_sha256 }}"
def install
bin.install "kubelogin_darwin_amd64" => "kubelogin"
ln_s bin/"kubelogin", bin/"kubectl-oidc_login"
@@ -19,4 +13,3 @@ class Kubelogin < Formula
system "#{bin}/kubectl-oidc_login -h"
end
end
EOF
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"github.com/int128/kubelogin/cli"
)
var version = "snapshot"
var version = "HEAD"
func main() {
c, err := cli.Parse(os.Args, version)