feat: go back to gitea
Some checks failed
Continuous Integration / lint_n_build (push) Has been cancelled
Some checks failed
Continuous Integration / lint_n_build (push) Has been cancelled
This commit is contained in:
80
Makefile
80
Makefile
@@ -1,57 +1,89 @@
|
||||
NAME = netoik-git
|
||||
VERSION = $(shell git describe --abbrev=0)
|
||||
RELEASE = $(shell git rev-parse --short HEAD)
|
||||
REFERENCE = $(if $(GIT_REFERENCE),$(GIT_REFERENCE),$(shell git branch --show-current))
|
||||
ARCH = noarch
|
||||
OWNER = samuel
|
||||
SUMMARY = "Netoïk Git server"
|
||||
LICENSE = "MIT"
|
||||
URL = "https://git.netoik.io/$(OWNER)/$(NAME)"
|
||||
SOURCE0 = "$(NAME)-$(VERSION)-$(RELEASE).tar.gz"
|
||||
|
||||
RPM_RPMDIR = $(shell rpm --eval '%{_rpmdir}')
|
||||
RPM_SBINDIR = $(shell rpm --eval '%{_sbindir}')
|
||||
RPM_SOURCEDIR = $(shell rpm --eval '%{_sourcedir}')
|
||||
RPM_SHAREDSTATEDIR = $(shell rpm --eval '%{_sharedstatedir}')
|
||||
RPM_SYSCONFDIR = $(shell rpm --eval '%{_sysconfdir}')
|
||||
RPM_TMPPATH = $(shell rpm --eval '%{_tmppath}')
|
||||
RPM_UNITDIR = $(shell rpm --eval '%{_unitdir}')
|
||||
|
||||
RPM_TARBALL_PATH = $(RPM_SOURCEDIR)/$(NAME)-$(VERSION)-$(RELEASE).tar.gz
|
||||
RPM_BUILD_PATH = $(RPM_RPMDIR)/$(BUILD_ARCH)/$(NAME)-$(VERSION)-$(RELEASE).$(BUILD_ARCH).rpm
|
||||
RPM_TARBALL_PATH = $(RPM_SOURCEDIR)/$(SOURCE0)
|
||||
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}'
|
||||
|
||||
.PHONY: name
|
||||
name:
|
||||
@echo $(NAME)
|
||||
name: ## Show project name
|
||||
@echo "$(NAME)"
|
||||
|
||||
.PHONY: version
|
||||
version:
|
||||
@echo $(VERSION)
|
||||
version: ## Show current project version
|
||||
@echo "$(VERSION)"
|
||||
|
||||
.PHONY: release
|
||||
release:
|
||||
@echo $(RELEASE)
|
||||
release: ## Show current project release
|
||||
@echo "$(RELEASE)"
|
||||
|
||||
.PHONY: arch
|
||||
arch:
|
||||
@echo $(ARCH)
|
||||
arch: ## Show rpm arch target
|
||||
@echo "$(ARCH)"
|
||||
|
||||
.PHONY: owner
|
||||
owner:
|
||||
@echo $(OWNER)
|
||||
owner: ## Show project owner name
|
||||
@echo "$(OWNER)"
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
install --mode=755 --directory $(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d $(DESTDIR)$(RPM_SYSCONFDIR)/forgejo/conf $(DESTDIR)$(RPM_UNITDIR)/forgejo.service.d
|
||||
install --mode=644 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d/ files/nginx/git.netoik.io.conf
|
||||
install --mode=660 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/forgejo/conf files/forgejo/netoik_app.ini
|
||||
install --mode=644 --target-directory=$(DESTDIR)$(RPM_UNITDIR)/forgejo.service.d files/systemd/forgejo.conf
|
||||
.PHONY: summary
|
||||
summary: ## Show project summary
|
||||
@echo "$(SUMMARY)"
|
||||
|
||||
.PHONY: license
|
||||
license: ## Show project license
|
||||
@echo "$(LICENSE)"
|
||||
|
||||
.PHONY: url
|
||||
url: ## Show project homepage URL
|
||||
@echo "$(URL)"
|
||||
|
||||
.PHONY: source0
|
||||
source0: ## Show rpm source0 file name
|
||||
@echo "$(SOURCE0)"
|
||||
|
||||
$(RPM_TARBALL_PATH): *
|
||||
git archive --format=tar.gz \
|
||||
--output="$@" \
|
||||
--prefix="$(NAME)-$(VERSION)/" \
|
||||
--verbose \
|
||||
"$(REFERENCE)"
|
||||
HEAD
|
||||
|
||||
.PHONY: tarball
|
||||
tarball: $(RPM_TARBALL_PATH)
|
||||
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; \
|
||||
exit 1; \
|
||||
fi
|
||||
install --mode=755 --directory $(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d $(DESTDIR)$(RPM_SYSCONFDIR)/gitea $(DESTDIR)$(RPM_UNITDIR) $(DESTDIR)$(RPM_TMPPATH)/gitea_images
|
||||
install --mode=644 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d files/nginx/git.netoik.io.conf
|
||||
install --mode=640 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/gitea files/gitea/app.ini
|
||||
install --mode=644 --target-directory=$(DESTDIR)$(RPM_UNITDIR) files/systemd/gitea.service
|
||||
install --mode=644 --target-directory=$(DESTDIR)$(RPM_TMPPATH)/gitea_images files/img/*
|
||||
|
||||
.PHONY: upload
|
||||
upload:
|
||||
curl --fail-with-body --upload-file "$(RPM_BUILD_PATH)" --user "$(OWNER):$(GIT_PACKAGES_TOKEN)" https://git.netoik.io/api/packages/$(OWNER)/rpm/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; \
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user