-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (40 loc) · 2.06 KB
/
Copy pathMakefile
File metadata and controls
53 lines (40 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
GOPATH := $(shell go env GOPATH | tr '\\' '/')
GOEXE := $(shell go env GOEXE)
GOHOSTOS := $(shell go env GOHOSTOS)
GOHOSTARCH := $(shell go env GOHOSTARCH)
GOHOSTARCHVERSION := $(shell go env "GO$(shell go env GOHOSTARCH | tr '[:lower:]' '[:upper:]')")
GORELEASER := $(GOPATH)/bin/goreleaser
GOVERSIONINFO := $(GOPATH)/bin/goversioninfo
SOURCE_FILES := *.go update/*
PLUGIN_PATH := dist/packer-plugin-windows-update_$(GOHOSTOS)_$(GOHOSTARCH)_$(GOHOSTARCHVERSION)/packer-plugin-windows-update_*_$(GOHOSTOS)_$(GOHOSTARCH)$(GOEXE)
# see https://github.com/goreleaser/goreleaser
# renovate: datasource=github-releases depName=goreleaser/goreleaser extractVersion=^v?(?<version>2\..+)
GORELEASER_VERSION := 2.17.0
# see https://github.com/josephspurrier/goversioninfo
# renovate: datasource=github-releases depName=josephspurrier/goversioninfo
GOVERSIONINFO_VERSION := 1.7.0
all: clean build
init: $(GORELEASER) $(GOVERSIONINFO)
go mod download
$(GORELEASER):
go install github.com/goreleaser/goreleaser/v2@v$(GORELEASER_VERSION)
$(GOVERSIONINFO):
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v$(GOVERSIONINFO_VERSION)
build: init $(SOURCE_FILES)
API_VERSION="$(shell go run . describe 2>/dev/null | jq -r .api_version)" \
$(GORELEASER) build --skip=validate --clean --single-target
release-snapshot: init $(SOURCE_FILES)
API_VERSION="$(shell go run . describe 2>/dev/null | jq -r .api_version)" \
$(GORELEASER) release --snapshot --skip=publish --clean
release: init $(SOURCE_FILES)
API_VERSION="$(shell go run . describe 2>/dev/null | jq -r .api_version)" \
$(GORELEASER) release --clean
# see https://www.packer.io/guides/hcl/component-object-spec/
update/provisioner.hcl2spec.go: update/provisioner.go
go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@$(shell go list -m -f '{{.Version}}' github.com/hashicorp/packer-plugin-sdk)
go generate update/provisioner.go
clean:
rm -rf update/provisioner.hcl2spec.go dist tmp* output-test *.log *.syso
test: build
./test.sh
.PHONY: all init build release release-snapshot install uninstall clean test