-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (34 loc) · 1.61 KB
/
Makefile
File metadata and controls
41 lines (34 loc) · 1.61 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
.PHONY: build login push push-version help tidy
# BSR organization - update this for your BSR account
BSR_ORG ?= pcelvng
PLUGIN_DIR := plugins/service-disallowed-naming
PLUGIN_NAME := service-disallowed-naming
VERSION ?= v0.1.0
help:
@echo "Targets:"
@echo " build - Build the service-disallowed-naming plugin (native + WASM)"
@echo " login - Log in to BSR (opens browser to authenticate)"
@echo " push - Push plugin to BSR (default BSR_ORG=pcelvng)"
@echo " push-version - Push plugin with version label (VERSION=$(VERSION), override with VERSION=x.y.z)"
@echo " tidy - Run go mod tidy in all plugin directories"
login:
buf registry login
build:
cd $(PLUGIN_DIR) && go build -o buf-plugin-$(PLUGIN_NAME) ./cmd/buf-plugin-$(PLUGIN_NAME)
cd $(PLUGIN_DIR) && GOOS=wasip1 GOARCH=wasm go build -o $(PLUGIN_NAME).wasm ./cmd/buf-plugin-$(PLUGIN_NAME)
@echo "Built: $(PLUGIN_DIR)/buf-plugin-$(PLUGIN_NAME) (native) and $(PLUGIN_DIR)/$(PLUGIN_NAME).wasm (WASM)"
push: build
cd $(PLUGIN_DIR) && buf plugin push buf.build/$(BSR_ORG)/$(PLUGIN_NAME) \
--binary=$(PLUGIN_NAME).wasm \
--create \
--create-type=check \
--create-visibility=public \
--source-control-url=https://github.com/$(BSR_ORG)/buf-build-plugins
push-version: build
@if [ -z "$(VERSION)" ]; then echo "Usage: make push-version VERSION=v0.1.0"; exit 1; fi
cd $(PLUGIN_DIR) && buf plugin push buf.build/$(BSR_ORG)/$(PLUGIN_NAME) \
--binary=$(PLUGIN_NAME).wasm \
--label=$(VERSION) \
--source-control-url=https://github.com/$(BSR_ORG)/buf-build-plugins/releases/tag/$(VERSION)
tidy:
cd $(PLUGIN_DIR) && go mod tidy