fuzzyworld

template / commit

Starting to add release capabilities.

b3de39c0ffa8c80f01ff5b0ffc051e099266cd70 · Pavel Safronov · 2022-11-15 23:42:09 -0800 · parents 6c53be41d965

Starting to add release capabilities.
 .gitignore       |  1 +
 .goreleaser.yaml | 31 +++++++++++++++++++++++++++++++
 Makefile         | 26 ++++++++------------------
 3 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/.gitignore b/.gitignore
index 4c85f83..2bd0841 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 .git
+dist
 template.exe
 template
 test
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
new file mode 100644
index 0000000..dbce2c2
--- /dev/null
+++ b/.goreleaser.yaml
@@ -0,0 +1,31 @@
+# This is an example .goreleaser.yml file with some sensible defaults.
+# Make sure to check the documentation at https://goreleaser.com
+before:
+  hooks:
+    # You may remove this if you don't use go modules.
+    - go mod tidy
+builds:
+  - env:
+      - CGO_ENABLED=0
+    goos:
+      - linux
+      - windows
+      - darwin
+archives:
+  - replacements:
+      darwin: Darwin
+      linux: Linux
+      windows: Windows
+      386: i386
+      amd64: x86_64
+checksum:
+  name_template: 'checksums.txt'
+snapshot:
+  name_template: "{{ incpatch .Version }}-next"
+changelog:
+  sort: asc
+  filters:
+    exclude:
+      - '^docs:'
+      - '^test:'
+
diff --git a/Makefile b/Makefile
index b0aa3bd..9201aa9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,6 @@
-profile = ""
-name = ""
-
 .PHONY: test
 
-all: build test install
+all: build test lint install
 
 clean:
 	go clean
@@ -32,17 +29,10 @@ install: build test lint
 uninstall:
 	go clean -i gitlab.com/fuzzy-rp/template...
 
-run:
-ifeq ($(name), "")
-ifeq ($(profile), "")
-	go run .
-else
-	go run . --profile=$(profile)
-endif
-else
-ifeq ($(profile), "")
-	go run . --name=$(name)
-else
-	go run . --profile=$(profile) --name=$(name)
-endif
-endif
+release-dry-run: build test lint
+	go install github.com/goreleaser/goreleaser@latest
+	goreleaser release --snapshot --rm-dist
+
+release-local: build test lint
+	go install github.com/goreleaser/goreleaser@latest
+	goreleaser build --single-target