54 lines
1.6 KiB
Makefile
54 lines
1.6 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))
|
|
BUILD_ARCH = noarch
|
|
|
|
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).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: build_arch
|
|
build_arch:
|
|
@echo "$(BUILD_ARCH)"
|
|
|
|
.PHONY: install
|
|
install:
|
|
install --mode=755 --directory $(DESTDIR)$(RPM_SYSCONFDIR)/gitea $(DESTDIR)$(RPM_UNITDIR) $(DESTDIR)$(RPM_SHAREDSTATEDIR)/actrunners
|
|
install --mode=644 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/gitea files/gitea/app.ini
|
|
install --mode=644 --target-directory=$(DESTDIR)$(RPM_UNITDIR) files/systemd/gitea.service files/systemd/actrunner@.service
|
|
|
|
$(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 "$(GIT_PACKAGES_USERNAME):$(GIT_PACKAGES_TOKEN)" https://git.netoik.io/api/packages/$(GIT_PACKAGES_USERNAME)/rpm/upload
|
|
|
|
|