1 Commits

2 changed files with 48 additions and 0 deletions

3
.gitignore vendored
View File

@@ -45,3 +45,6 @@ coverage/
*.p12
*.pfx
secrets/
# Build
*.zip

45
Makefile Normal file
View File

@@ -0,0 +1,45 @@
# Makefile for publishing Go modules to Gitea Package Registry
# --- Configuration ---
# Set this to the exact module path from your go.mod file.
MODULE_PATH := git.psmattas.com/evercatch/evercatch-go
GITEA_OWNER := Evercatch
GITEA_REGISTRY_URL := https://git.psmattas.com/api/packages/$(GITEA_OWNER)/go/upload
# --- Variables (do not edit) ---
# Automatically gets the latest git tag (e.g., v0.0.2)
VERSION := $(shell git describe --tags --abbrev=0)
ZIP_FILENAME := $(VERSION).zip
# Reads the Gitea token from your environment.
# Must be run as: GITEA_TOKEN=... make publish
TOKEN := ${GITEA_TOKEN}
# --- Commands ---
# This is a special directive to tell Make that these are command names, not files.
.PHONY: all publish package clean
all: publish
# packages the module into a correctly structured zip file.
package:
@echo "📦 Packaging module $(MODULE_PATH) version $(VERSION)..."
@git archive --format=zip \
--prefix="$(MODULE_PATH)@$(VERSION)/" \
-o "$(ZIP_FILENAME)" \
"$(VERSION)"
@echo "✅ Successfully created $(ZIP_FILENAME)"
# publishes the packaged zip file to the Gitea registry.
publish: package
@echo "⬆️ Uploading $(ZIP_FILENAME) to Gitea..."
@curl --user "$(GITEA_OWNER):$(TOKEN)" \
--upload-file "$(ZIP_FILENAME)" \
"$(GITEA_REGISTRY_URL)"
@echo "\n✅ Successfully published to Gitea."
@make clean
# removes the generated zip file.
clean:
@echo "🧹 Cleaning up..."
@rm -f "$(ZIP_FILENAME)"