feat: adapt on nginx versionning
All checks were successful
Continuous Integration / lint_n_build (push) Successful in 35s
Continuous Delivery / build_n_upload (push) Successful in 25s

This commit is contained in:
2026-08-28 13:03:39 +02:00
parent 72dea1d665
commit c76193dcc5
5 changed files with 93 additions and 37 deletions

View File

@@ -1,12 +1,17 @@
NAME = netoik-rp
VERSION = $(shell git describe --abbrev=0)
RELEASE = $(shell git rev-parse --short HEAD)
TAG = $(shell git describe --abbrev=0)
TAG_SPLIT = $(subst -, ,$(TAG))
EPOCH = $(word 1,$(TAG_SPLIT))
VERSION = $(word 2,$(TAG_SPLIT))
RELEASE = $(word 3,$(TAG_SPLIT))
RELEASE_SPLIT = $(subst ., ,$(RELEASE))
RELEASE_NGINX = $(word 1,$(RELEASE_SPLIT)).$(word 3,$(RELEASE_SPLIT))
ARCH = noarch
OWNER = netoik
SUMMARY = "Netoïk Reverse Proxy"
LICENSE = "MIT"
URL = "https://git.netoik.io/$(OWNER)/$(NAME)"
SOURCE0 = "$(NAME)-$(VERSION)-$(RELEASE).tar.gz"
SOURCE0 = "$(NAME)-$(EPOCH)-$(VERSION)-$(RELEASE).tar.gz"
RPM_RPMDIR = $(shell rpm --eval '%{_rpmdir}')
RPM_SBINDIR = $(shell rpm --eval '%{_sbindir}')
@@ -19,12 +24,21 @@ RPM_BUILD_PATH = $(RPM_RPMDIR)/$(ARCH)/$(NAME)-$(VERSION)-$(RELEASE).$(ARCH).rpm
.PHONY: help
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: name
name: ## Show project name
@echo "$(NAME)"
.PHONY: tag
tag: ## Show last tag
@echo "$(TAG)"
.PHONY: epoch
epoch: ## Show project epoch
@echo "$(EPOCH)"
.PHONY: version
version: ## Show current project version
@echo "$(VERSION)"
@@ -33,6 +47,10 @@ version: ## Show current project version
release: ## Show current project release
@echo "$(RELEASE)"
.PHONY: release_nginx
release_nginx: ## Show nginx release
@echo "$(RELEASE_NGINX)"
.PHONY: arch
arch: ## Show rpm arch target
@echo "$(ARCH)"
@@ -57,7 +75,7 @@ url: ## Show project homepage URL
source0: ## Show rpm source0 file name
@echo "$(SOURCE0)"
$(RPM_TARBALL_PATH): *
$(RPM_TARBALL_PATH):
git archive --format=tar.gz \
--output="$@" \
--prefix="$(NAME)-$(VERSION)/" \
@@ -70,19 +88,37 @@ tarball: $(RPM_TARBALL_PATH) ## Build rpm tarball
.PHONY: install
install: ## Install files into rpm dest (requires env var DESTDIR)
@if [ -z "$(DESTDIR)" ]; then \
printf "[CRITICAL] Missing env var DESTDIR\n[CRITICAL] This command is designed to be called by rpmbuild only!\n" 1>&2; \
printf "[CRITICAL] Missing env var DESTDIR\n" 1>&2; \
printf "[CRITICAL] This command is designed to be called by rpmbuild only!\n" 1>&2; \
exit 1; \
fi
install --mode=755 --directory $(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d $(DESTDIR)$(RPM_SYSCONFDIR)/certbot $(DESTDIR)$(RPM_UNITDIR) $(DESTDIR)$(RPM_SBINDIR)
install --mode=644 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d files/nginx/0_security.conf files/nginx/z_default.conf
install --mode=600 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/certbot files/certbot/ovh.ini
install --mode=644 --target-directory=$(DESTDIR)$(RPM_UNITDIR) files/systemd/certbot-renew.service files/systemd/certbot-renew.timer
install --mode=755 --target-directory=$(DESTDIR)$(RPM_SBINDIR) files/sbin/certbot_renew
install --mode=755 \
--directory $(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d \
$(DESTDIR)$(RPM_SYSCONFDIR)/certbot \
$(DESTDIR)$(RPM_UNITDIR) \
$(DESTDIR)$(RPM_SBINDIR)
install --mode=644 \
--target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d \
files/nginx/0_security.conf files/nginx/z_default.conf
install --mode=600 \
--target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/certbot \
files/certbot/ovh.ini
install --mode=644 \
--target-directory=$(DESTDIR)$(RPM_UNITDIR) \
files/systemd/certbot-renew.service \
files/systemd/certbot-renew.timer
install --mode=755 \
--target-directory=$(DESTDIR)$(RPM_SBINDIR) \
files/sbin/certbot_renew
.PHONY: upload
upload: ## Upload rpm package to Gitea repository (requires env var PKG_TOKEN)
@if [ -z "$(PKG_TOKEN)" ]; then \
printf "[CRITICAL] Missing env var PKG_TOKEN\n[CRITICAL] This command is designed to be called by Gitea Actions only!\n" 1>&2; \
printf "[CRITICAL] Missing env var PKG_TOKEN\n" 1>&2; \
printf "[CRITICAL]This command is designed to be called by Gitea Actions only!\n" 1>&2; \
exit 1; \
fi
curl --fail-with-body --upload-file "$(RPM_BUILD_PATH)" --user "$(OWNER):$(PKG_TOKEN)" https://git.netoik.io/api/packages/$(OWNER)/rpm/upload
curl --fail-with-body \
--upload-file "$(RPM_BUILD_PATH)" \
--user "$(OWNER):$(PKG_TOKEN)" \
https://git.netoik.io/api/packages/$(OWNER)/rpm/upload