From dc894293b62651fd90d17c87adfea283775c5a55 Mon Sep 17 00:00:00 2001 From: samuel Date: Sat, 7 Mar 2026 12:50:53 +0100 Subject: [PATCH] refactor: migrate to forgejo --- .forgejo/workflows/cd.yaml | 19 +++++++++++++++++ .forgejo/workflows/ci.yaml | 17 +++++++++++++++ .gitea/workflows/cd.yaml | 26 ----------------------- .gitea/workflows/ci.yaml | 22 ------------------- Makefile | 43 ++++++++++++++++++++++++++++++-------- netoik-rp.spec | 10 ++++----- 6 files changed, 75 insertions(+), 62 deletions(-) create mode 100644 .forgejo/workflows/cd.yaml create mode 100644 .forgejo/workflows/ci.yaml delete mode 100644 .gitea/workflows/cd.yaml delete mode 100644 .gitea/workflows/ci.yaml diff --git a/.forgejo/workflows/cd.yaml b/.forgejo/workflows/cd.yaml new file mode 100644 index 0000000..03b8955 --- /dev/null +++ b/.forgejo/workflows/cd.yaml @@ -0,0 +1,19 @@ +name: Continuous Delivery + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +jobs: + build_n_upload: + runs-on: linux + steps: + - uses: actions/checkout@v6 + with: + fetch-tags: true + - run: make tarball + - run: rpmbuild -ba "$(make name).spec" + - run: make upload + env: + PKG_TOKEN: ${{ secrets.PKG_TOKEN }} diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml new file mode 100644 index 0000000..7c95227 --- /dev/null +++ b/.forgejo/workflows/ci.yaml @@ -0,0 +1,17 @@ +name: Continuous Integration + +on: + push: + branches: + - main + +jobs: + lint_n_build: + runs-on: linux + steps: + - uses: actions/checkout@v6 + with: + fetch-tags: true + - run: shellcheck files/sbin/certbot_renew + - run: make tarball + - run: rpmbuild -ba "$(make name).spec" diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml deleted file mode 100644 index dc4c85a..0000000 --- a/.gitea/workflows/cd.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: Continuous Delivery - -on: - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" - -jobs: - build_n_upload: - runs-on: linux - steps: - - name: Git checkout - uses: actions/checkout@v6 - with: - fetch-tags: true - - name: Build tarball - run: make tarball - env: - GIT_REFERENCE: ${{ github.ref }} - - name: Build rpm package - run: rpmbuild -ba "$(make name).spec" - - name: Upload rpm package - run: make upload - env: - GIT_PACKAGES_USERNAME: ${{ vars.GIT_PACKAGES_USERNAME }} - GIT_PACKAGES_TOKEN: ${{ secrets.GIT_PACKAGES_TOKEN }} diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml deleted file mode 100644 index ae478dc..0000000 --- a/.gitea/workflows/ci.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: Continuous Integration - -on: - push: - branches: - - main - -jobs: - lint_n_build: - runs-on: linux - steps: - - name: Git checkout - uses: actions/checkout@v6 - with: - fetch-depth: 0 - fetch-tags: true - - name: Lint shell scripts - run: shellcheck files/sbin/certbot_renew - - name: Build tarball - run: make tarball - - name: Build rpm file - run: rpmbuild -ba netoik-rp.spec diff --git a/Makefile b/Makefile index 7249e96..db3beeb 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,21 @@ NAME = netoik-rp 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 +ARCH = noarch +OWNER = samuel +SUMMARY = "Netoïk Reverse Proxy" +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_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 + +RPM_TARBALL_PATH = $(RPM_SOURCEDIR)/$(SOURCE0) +RPM_BUILD_PATH = $(RPM_RPMDIR)/$(BUILD_ARCH)/$(NAME)-$(VERSION)-$(RELEASE).$(ARCH).rpm .PHONY: name name: @@ -24,9 +29,29 @@ version: release: @echo "$(RELEASE)" -.PHONY: build_arch -build_arch: - @echo "$(BUILD_ARCH)" +.PHONY: arch +arch: + @echo "$(ARCH)" + +.PHONY: owner +owner: + @echo "$(OWNER)" + +.PHONY: summary +summary: + @echo "$(SUMMARY)" + +.PHONY: license +license: + @echo "$(LICENSE)" + +.PHONY: url +url: + @echo "$(URL)" + +.PHONY: source0 +source0: + @echo "$(SOURCE0)" .PHONY: install install: @@ -41,11 +66,11 @@ $(RPM_TARBALL_PATH): * --output="$@" \ --prefix="$(NAME)-$(VERSION)/" \ --verbose \ - "$(REFERENCE)" + HEAD .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/samuel/rpm/upload + curl --fail-with-body --upload-file "$(RPM_BUILD_PATH)" --user "$(OWNER):$(PKG_TOKEN)" https://git.netoik.io/api/packages/$(OWNER)/rpm/upload diff --git a/netoik-rp.spec b/netoik-rp.spec index 2b3735d..9176dd4 100644 --- a/netoik-rp.spec +++ b/netoik-rp.spec @@ -3,12 +3,12 @@ Name: %(make name) Version: %(make version) Release: %(make release) -Summary: Netoik Reverse Proxy -License: MIT -URL: https://git.netoik.io/samuel/netoik-rp +Summary: %(make summary) +License: %(make license) +URL: %(make url) -Source0: %{name}-%{version}.tar.gz -Buildarch: %(make build_arch) +Source0: %(make source0) +Buildarch: %(make arch) BuildRequires: make Requires: nginx python3 python-devel (augeas-devel or augeas-libs) gcc openssl