58 lines
1.7 KiB
Makefile
58 lines
1.7 KiB
Makefile
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
|
|
|
|
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_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
|
|
|
|
.PHONY: name
|
|
name:
|
|
@echo $(NAME)
|
|
|
|
.PHONY: version
|
|
version:
|
|
@echo $(VERSION)
|
|
|
|
.PHONY: release
|
|
release:
|
|
@echo $(RELEASE)
|
|
|
|
.PHONY: arch
|
|
arch:
|
|
@echo $(ARCH)
|
|
|
|
.PHONY: owner
|
|
owner:
|
|
@echo $(OWNER)
|
|
|
|
.PHONY: install
|
|
install:
|
|
install --mode=755 --directory $(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=640 --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
|
|
|
|
$(RPM_TARBALL_PATH): *
|
|
git archive --format=tar.gz \
|
|
--output="$@" \
|
|
--prefix="$(NAME)-$(VERSION)/" \
|
|
--verbose \
|
|
"$(REFERENCE)"
|
|
|
|
.PHONY: tarball
|
|
tarball: $(RPM_TARBALL_PATH)
|
|
|
|
.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
|