feat: first commit
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled

This commit is contained in:
2026-02-24 01:33:07 +01:00
parent 556cb8098c
commit 89af50a63f
10 changed files with 209 additions and 2 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
.gitignore export-ignore
.gitattributes export-ignore

27
.gitea/workflows/cd.yaml Normal file
View File

@@ -0,0 +1,27 @@
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 }}

21
.gitea/workflows/ci.yaml Normal file
View File

@@ -0,0 +1,21 @@
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: Build tarball
run: make tarball
- name: Build rpm file
run: rpmbuild -ba "$(make name).spec"

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
*.swp
*.env
/.idea

51
Makefile Normal file
View File

@@ -0,0 +1,51 @@
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_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)/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

View File

@@ -1,3 +1,3 @@
# netoik-git
# Netoïk Git ![badge](https://git.netoik.io/samuel/netoik-git/actions/workflows/ci.yaml/badge.svg)
Netoïk Git server
Build an RPM package which will install the Git UI server called Gitea.

33
files/gitea/app.ini Normal file
View File

@@ -0,0 +1,33 @@
# Do not edit this file unless you are aware about what you are doing!
# See official doc here: https://docs.gitea.com/next/administration/config-cheat-sheet
APP_NAME = Netoïk Git Server
RUN_USER = gitea
RUN_MODE = prod
WORK_PATH = /var/lib/gitea
[server]
DOMAIN = git.netoik.io
ROOT_URL = https://git.netoik.io/
HTTP_ADDR = 127.0.0.1
HTTP_PORT = 3000
SSH_DOMAIN = git.netoik.io
SSH_PORT = 22222
[database]
DB_TYPE = postgres
HOST = /run/postgresql
NAME = gitea
USER = gitea
[security]
INSTALL_LOCK = true
SECRET_KEY = $SECRET_KEY
INTERNAL_TOKEN = $INTERNAL_TOKEN
[service]
DISABLE_REGISTRATION = true
[session]
PROVIDER = redis
PROVIDER_CONFIG = /run/redis/redis.sock

View File

@@ -0,0 +1,17 @@
[Unit]
Description=Gitea Actions runner #%i
Documentation=https://gitea.com/gitea/act_runner
After=network.target gitea.service
[Service]
ExecStartPre=/usr/bin/rpmdev-setuptree
ExecStart=/usr/local/bin/act_runner daemon
ExecReload=/bin/kill -s HUP $MAINPID
WorkingDirectory=/opt/actrunners/actrunner%i
TimeoutSec=0
RestartSec=10
Restart=always
User=actrunner%i
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,15 @@
[Unit]
Description=Gitea (Git with a cup of tea)
After=network.target postgresql.service
[Service]
RestartSec=2s
Type=simple
User=gitea
Group=gitea
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
[Install]
WantedBy=multi-user.target

38
netoik-git.spec Normal file
View File

@@ -0,0 +1,38 @@
%define debug_package %{nil}
Name: %(make name)
Version: %(make version)
Release: %(make release)
Summary: Netoik Reverse Proxy
License: MIT
URL: https://git.netoik.io/samuel/%(make name)
Source0: %{name}-%{version}.tar.gz
Buildarch: %(make build_arch)
BuildRequires: make
Requires: netoik-db git
%description
Install the Git UI server called Gitea.
%prep
%autosetup -v
%install
%make_install
%post
%files
%dir %attr(755, root, root) %{_sysconfdir}/gitea
%attr(600, root, root) %{_sysconfdir}/gitea/app.ini
%attr(644, root, root) %{_unitdir}/gitea.service
%attr(644, root, root) %{_unitdir}/actrunner@.service
%dir %attr(755, root, root) /opt/actrunners
%changelog
%autochangelog