github.com/emicklei/gmig@v1.18.3-0.20240405210147-57c940a1c6cf/Makefile (about)

     1  VERSION := $(shell git describe --always)
     2  
     3  clean:
     4  	rm -rf target
     5  
     6  build:
     7  	docker run --rm -it -v "${PWD}":/src -w /src golang make build_inside
     8  
     9  build_inside:
    10  	cd /src && \
    11  	rm -rf target && \
    12  	mkdir -p target/windows && \
    13  	mkdir -p target/darwin && \
    14  	mkdir -p target/linux && \
    15  	GOOS=windows go build -ldflags "-X main.Version=$(VERSION)" -o target/windows/gmig.exe && \
    16  	GOOS=darwin go build -ldflags "-X main.Version=$(VERSION)" -o target/darwin/gmig && \
    17  	GOOS=linux go build -ldflags "-X main.Version=$(VERSION)" -o target/linux/gmig && \
    18  	chmod +x -R target
    19  
    20  zip:
    21  	zip target/darwin/gmig.zip target/darwin/gmig && \
    22  	zip target/linux/gmig.zip target/linux/gmig && \
    23  	zip target/windows/gmig.zip target/windows/gmig.exe
    24  
    25  # go get github.com/aktau/github-release
    26  # export GITHUB_TOKEN=...
    27  .PHONY: createrelease
    28  createrelease:
    29  	github-release info -u emicklei -r gmig
    30  	github-release release \
    31  		--user emicklei \
    32  		--repo gmig \
    33  		--tag $(shell git describe --abbrev=0 --tags) \
    34  		--name "gmig" \
    35  		--description "gmig - google infrastructure-as-code tool"
    36  
    37  .PHONY: uploadrelease
    38  uploadrelease:
    39  	github-release upload \
    40  		--user emicklei \
    41  		--repo gmig \
    42  		--tag $(shell git describe --abbrev=0 --tags) \
    43  		--name "gmig-Linux-x86_64.zip" \
    44  		--file target/linux/gmig.zip
    45  
    46  	github-release upload \
    47  		--user emicklei \
    48  		--repo gmig \
    49  		--tag $(shell git describe --abbrev=0 --tags) \
    50  		--name "gmig-Darwin-x86_64.zip" \
    51  		--file target/darwin/gmig.zip
    52  
    53  	github-release upload \
    54  		--user emicklei \
    55  		--repo gmig \
    56  		--tag $(shell git describe --abbrev=0 --tags) \
    57  		--name "gmig-Windows-x86_64.zip" \
    58  		--file target/windows/gmig.zip
    59  
    60  release: build zip createrelease uploadrelease