release: 1.1.1 - session auth and security improvements

This commit is contained in:
2026-10-05 22:36:24 +03:00
parent 1cd3cb9a2e
commit b1cd985720
8 changed files with 2539 additions and 539 deletions
+105 -21
View File
@@ -1,31 +1,40 @@
APP_NAME := ric930-fake-smtp
VERSION ?= 1.1.0
GO := go
BUILD_DIR := builds
LINUX_DIR := $(BUILD_DIR)/linux
WINDOWS_DIR := $(BUILD_DIR)/windows
RELEASE_DIR := $(BUILD_DIR)/releases
LINUX_BIN := $(LINUX_DIR)/$(APP_NAME)
WINDOWS_BIN := $(WINDOWS_DIR)/$(APP_NAME).exe
GO := go
LINUX_ARCHIVE := $(RELEASE_DIR)/$(APP_NAME)_$(VERSION)_linux_amd64.tar.gz
WINDOWS_ARCHIVE := $(RELEASE_DIR)/$(APP_NAME)_$(VERSION)_windows_amd64.zip
BUILD_FLAGS := -trimpath
LDFLAGS := -s -w
.PHONY: all
.PHONY: build
.PHONY: build-all
.PHONY: build-linux
.PHONY: build-windows
.PHONY: release
.PHONY: package-linux
.PHONY: package-windows
.PHONY: clean
.PHONY: fmt
.PHONY: tidy
.PHONY: check
# ------------------------------------------------------------
# Host OS
# ------------------------------------------------------------
# ============================================================
# Host OS helpers
# ============================================================
ifeq ($(OS),Windows_NT)
@@ -68,9 +77,9 @@ endef
endif
# ------------------------------------------------------------
# Default
# ------------------------------------------------------------
# ============================================================
# Default targets
# ============================================================
all: build-all
@@ -79,9 +88,9 @@ build: build-all
build-all: build-linux build-windows
# ------------------------------------------------------------
# Linux
# ------------------------------------------------------------
# ============================================================
# Linux build
# ============================================================
build-linux:
@echo "==> Building Linux amd64"
@@ -93,12 +102,20 @@ ifeq ($(OS),Windows_NT)
@set "CGO_ENABLED=0" && \
set "GOOS=linux" && \
set "GOARCH=amd64" && \
$(GO) build $(BUILD_FLAGS) -ldflags="$(LDFLAGS)" -o "$(subst /,\,$(LINUX_BIN))" .
$(GO) build \
$(BUILD_FLAGS) \
-ldflags="$(LDFLAGS)" \
-o "$(subst /,\,$(LINUX_BIN))" \
.
else
@CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
$(GO) build $(BUILD_FLAGS) -ldflags="$(LDFLAGS)" -o "$(LINUX_BIN)" .
$(GO) build \
$(BUILD_FLAGS) \
-ldflags="$(LDFLAGS)" \
-o "$(LINUX_BIN)" \
.
endif
$(call copy_file,config.yaml,$(LINUX_DIR)/config.yaml)
@@ -107,9 +124,9 @@ endif
@echo "==> Linux build created: $(LINUX_DIR)"
# ------------------------------------------------------------
# Windows
# ------------------------------------------------------------
# ============================================================
# Windows build
# ============================================================
build-windows:
@echo "==> Building Windows amd64"
@@ -121,12 +138,20 @@ ifeq ($(OS),Windows_NT)
@set "CGO_ENABLED=0" && \
set "GOOS=windows" && \
set "GOARCH=amd64" && \
$(GO) build $(BUILD_FLAGS) -ldflags="$(LDFLAGS)" -o "$(subst /,\,$(WINDOWS_BIN))" .
$(GO) build \
$(BUILD_FLAGS) \
-ldflags="$(LDFLAGS)" \
-o "$(subst /,\,$(WINDOWS_BIN))" \
.
else
@CGO_ENABLED=0 \
GOOS=windows \
GOARCH=amd64 \
$(GO) build $(BUILD_FLAGS) -ldflags="$(LDFLAGS)" -o "$(WINDOWS_BIN)" .
$(GO) build \
$(BUILD_FLAGS) \
-ldflags="$(LDFLAGS)" \
-o "$(WINDOWS_BIN)" \
.
endif
$(call copy_file,config.yaml,$(WINDOWS_DIR)/config.yaml)
@@ -135,12 +160,71 @@ endif
@echo "==> Windows build created: $(WINDOWS_DIR)"
# ------------------------------------------------------------
# ============================================================
# Release
# ============================================================
release: build-all package-linux package-windows
@echo ""
@echo "==> Release $(VERSION) created"
@echo " Linux: $(LINUX_ARCHIVE)"
@echo " Windows: $(WINDOWS_ARCHIVE)"
# ============================================================
# Linux package
# ============================================================
package-linux:
@echo "==> Creating Linux release archive"
$(call make_dir,$(RELEASE_DIR))
ifeq ($(OS),Windows_NT)
@tar \
-C "$(subst /,\,$(LINUX_DIR))" \
-czf "$(subst /,\,$(LINUX_ARCHIVE))" \
.
else
@tar \
-C "$(LINUX_DIR)" \
-czf "$(LINUX_ARCHIVE)" \
.
endif
@echo "==> Linux archive created: $(LINUX_ARCHIVE)"
# ============================================================
# Windows package
# ============================================================
package-windows:
@echo "==> Creating Windows release archive"
$(call make_dir,$(RELEASE_DIR))
ifeq ($(OS),Windows_NT)
@powershell -NoProfile -Command \
"Compress-Archive \
-Path '$(subst /,\,$(WINDOWS_DIR))\*' \
-DestinationPath '$(subst /,\,$(WINDOWS_ARCHIVE))' \
-Force"
else
@rm -f "$(WINDOWS_ARCHIVE)"
@cd "$(WINDOWS_DIR)" && \
zip -qr \
"../releases/$(APP_NAME)_$(VERSION)_windows_amd64.zip" \
.
endif
@echo "==> Windows archive created: $(WINDOWS_ARCHIVE)"
# ============================================================
# Maintenance
# ------------------------------------------------------------
# ============================================================
clean:
@echo "==> Cleaning builds"
@echo "==> Cleaning build directory"
$(call remove_dir,$(BUILD_DIR))
@@ -155,7 +239,7 @@ tidy:
check:
@echo "==> Checking project"
@echo "==> Running Go checks"
@$(GO) vet ./...
@$(GO) test ./...