|
1 | 1 | SHELL:=/bin/bash
|
2 |
| -export VERSION=0.1 |
| 2 | +export VERSION=0.2 |
3 | 3 |
|
4 | 4 | .PHONY: all
|
5 | 5 | all: build
|
6 | 6 |
|
7 |
| -.DEFAULT_GOAL := all |
| 7 | +.DEFAULT_GOAL := help |
8 | 8 |
|
9 | 9 | current_dir = $(shell pwd)
|
10 | 10 |
|
| 11 | +#help: @ List available tasks on this project |
| 12 | +help: |
| 13 | + @grep -E '[a-zA-Z\.\-]+:.*?@ .*$$' $(MAKEFILE_LIST)| tr -d '#' | awk 'BEGIN {FS = ":.*?@ "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
| 14 | + |
| 15 | +#build: @ Build binaris with go |
11 | 16 | build:
|
12 |
| - rm -rf dist |
| 17 | + rm -rf dist/{windows,linux,osx,release} |
13 | 18 | go build -o dist/linux/kubectl-login main.go
|
14 | 19 | env GOOS=darwin GOARCH=amd64 go build -o dist/osx/kubectl-login main.go
|
15 | 20 | env GOOS=windows GOARCH=amd64 go build -o dist/windows/kubectl-login.exe main.go
|
16 |
| -# docker run -v $(pwd):/src -w /src -it --rm linuturk/mono-choco new kubectl-login |
17 | 21 |
|
| 22 | +#package: @ Create archives, brew and choco files |
18 | 23 | package:
|
19 |
| -# mkdir -p dist/release |
20 |
| -# cd dist/linux; \ |
| 24 | + @echo "🎁 Packaging" |
| 25 | + mkdir -p dist/release |
| 26 | + |
| 27 | + cd dist/linux; \ |
21 | 28 | chmod +x kubectl-login; \
|
22 |
| - tar -czf kubectl-login_linux.tar.gz kubectl-login |
23 |
| -# CHECKSUM=$$(sha256sum dist/linux/kubectl-login_linux.tar.gz | cut -d ' ' -f1); \ |
| 29 | + tar -czf kubectl-login_linux.tar.gz kubectl-login; \ |
| 30 | + sha256sum dist/linux/kubectl-login_linux.tar.gz > dist/linux/kubectl-login_linux.tar.gz.sha256 |
| 31 | + |
| 32 | + CHECKSUM=$$(sha256sum dist/linux/kubectl-login_linux.tar.gz | cut -d ' ' -f1); \ |
24 | 33 | sed -i "s/#checksum_linux#/$$CHECKSUM/" dist/homebrew/kubectl-login.rb; \
|
25 |
| - sed -i "s/#version#/${VERSION}/" dist/homebrew/kubectl-login.rb |
| 34 | + sed -i "s/#version#/${VERSION}/" dist/homebrew/kubectl-login.rb; \ |
| 35 | + sed -i "s/#checksum_linux#/$$CHECKSUM/" dist/krew/openid-connect.yaml; \ |
| 36 | + sed -i "s/#version#/${VERSION}/" dist/krew/openid-connect.yaml; |
26 | 37 |
|
27 |
| -# cd dist/osx; \ |
| 38 | + cd dist/osx; \ |
28 | 39 | chmod +x kubectl-login; \
|
29 |
| - tar -czf kubectl-login_osx.tar.gz kubectl-login |
30 |
| -# CHECKSUM=$$(sha256sum dist/osx/kubectl-login_osx.tar.gz | cut -d ' ' -f1); \ |
31 |
| -# sed -i "s/#checksum_osx#/$$CHECKSUM/" dist/homebrew/kubectl-login.rb |
| 40 | + tar -czf kubectl-login_osx.tar.gz kubectl-login; \ |
| 41 | + sha256sum dist/linux/kubectl-login_osx.tar.gz > dist/linux/kubectl-login_osx.tar.gz.sha256 |
32 | 42 |
|
33 |
| -# cd dist/windows; \ |
34 |
| - zip kubectl-login_windows.zip kubectl-login.exe |
| 43 | + CHECKSUM=$$(sha256sum dist/osx/kubectl-login_osx.tar.gz | cut -d ' ' -f1); \ |
| 44 | + sed -i "s/#checksum_osx#/$$CHECKSUM/" dist/homebrew/kubectl-login.rb; \ |
| 45 | + sed -i "s/#checksum_osx#/$$CHECKSUM/" dist/krew/openid-connect.yaml |
| 46 | + |
| 47 | + cd dist/windows; \ |
| 48 | + zip kubectl-login_windows.zip kubectl-login.exe; \ |
| 49 | + sha256sum dist/linux/kubectl-login_windows.zip > dist/linux/kubectl-login_windows.zip.sha256 |
35 | 50 |
|
36 | 51 | CHECKSUM=$$(sha256sum dist/windows/kubectl-login_windows.zip | cut -d ' ' -f1); \
|
| 52 | + ed -i "s/#checksum_windows#/$$CHECKSUM/" dist/krew/openid-connect.yaml; \ |
37 | 53 | sed -i "s/#checksum#/$$CHECKSUM/" dist/choco/tools/VERIFICATION.txt; \
|
38 | 54 | sed -i "s/#version#/${VERSION}/" dist/choco/tools/VERIFICATION.txt; \
|
39 | 55 | sed -i "s/#version#/${VERSION}/" dist/choco/kubectl-login.nuspec
|
40 | 56 | cp dist/windows/kubectl-login_windows.zip dist/choco/tools/
|
41 | 57 | docker run -v `pwd`/dist/choco/:/src -w /src -it --rm linuturk/mono-choco pack
|
42 | 58 | rm -f dist/choco/tools/kubectl-login_windows.zip
|
43 | 59 |
|
| 60 | +#release: @ Create release on github and publish choco package |
44 | 61 | release:
|
45 |
| -# mv dist/windows/kubectl-login_windows.zip dist/release/ |
46 |
| -# mv dist/linux/kubectl-login_linux.tar.gz dist/release/ |
47 |
| -# mv dist/osx/kubectl-login_osx.tar.gz dist/release/ |
48 |
| -# mv dist/choco/kubectl-login*.nupkg dist/release/ |
49 |
| -# gh release create client_v${VERSION} --generate-notes ./dist/release/* |
50 |
| - docker run -v `pwd`/dist/choco/:/src -w /src -it --rm linuturk/mono-choco push kubectl-login.${VERSION}.nupkg --key ${CHOCO_TOKEN} --source https://push.chocolatey.org/ |
| 62 | + @echo "🤖 CD bot is DReleasing |
| 63 | + |
| 64 | + mv dist/windows/kubectl-login_windows.zip* dist/release/ |
| 65 | + mv dist/linux/kubectl-login_linux.tar.gz* dist/release/ |
| 66 | + mv dist/osx/kubectl-login_osx.tar.gz* dist/release/ |
| 67 | + mv dist/choco/kubectl-login*.nupkg dist/release/ |
| 68 | + gh release create client_v${VERSION} --generate-notes ./dist/release/* |
| 69 | + |
| 70 | +# docker run -v `pwd`/dist/choco/:/src -w /src -it --rm linuturk/mono-choco push kubectl-login.${VERSION}.nupkg --key ${CHOCO_TOKEN} --source https://push.chocolatey.org/ |
| 71 | + |
| 72 | + git clone [email protected]:devopstales/homebrew-devopstales.git; \ |
| 73 | + cd homebrew-devopstales; \ |
| 74 | + git config user.name "devopstales"; \ |
| 75 | + git config user.email " [email protected]"; \ |
| 76 | + rm -f kubectl-login.rb; \ |
| 77 | + cp ../dist/homebrew/kubectl-login.rb .; \ |
| 78 | + git add kubectl-login.rb && git commit -m "release ${VERSION}"; \ |
| 79 | + git push |
| 80 | + |
| 81 | + git clone [email protected]:devopstales/krew-index.git; \ |
| 82 | + cd krew-index/plugins; \ |
| 83 | + git config user.name "devopstales"; \ |
| 84 | + git config user.email " [email protected]"; \ |
| 85 | + rm -f openid-connect.yaml; \ |
| 86 | + cp ../../dist/krew/openid-connect.yaml; \ |
| 87 | + git add openid-connect.yaml && git commit -m "release ${VERSION}"; \ |
| 88 | + git push |
| 89 | + |
51 | 90 | # rm -rf dist/{windows,linux,osx,release}
|
| 91 | +# rm -rf homebrew-devopstales |
| 92 | +# rm -rf krew-index |
| 93 | + @echo "🚀 Packages are deployed!" |
52 | 94 |
|
0 commit comments