👷 Add release stage
All checks were successful
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/tag/release Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/tag/test Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/tag/lint Pipeline was successful

This commit is contained in:
Ada 2024-05-25 14:26:08 +02:00
parent 374a40f910
commit 3a871d4f7c
Signed by: ada
GPG key ID: 6A7F898157C6DE6E
8 changed files with 116 additions and 1 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
dist/
.idea
config.toml
spiegel

68
.goreleaser.yaml Normal file
View file

@ -0,0 +1,68 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
gitea_urls:
api: https://git.gnous.eu/api/v1
download: https://git.gnous.eu
skip_tls_verify: false
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- arm64
archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
nfpms:
-
id: spiegel
package_name: spiegel
file_name_template: "{{ .ConventionalFileName }}"
vendor: Ada
homepage: https://git.gnous.eu/ada/spiegel
maintainer: Ada <ada@gnous.eu>
description: A light paste server
license: MPL-2.0
formats:
- deb
- rpm
- archlinux
umask: 002
provides:
- spiegel
contents:
- src: config.example.toml
dst: /etc/spiegel/config.toml
- src: deployment/goreleaser/spiegel.service
dst: /usr/lib/systemd/system/spiegel.service
scripts:
preinstall: "deployment/goreleaser/preinstall.sh"
preremove: "deployment/goreleaser/preremove.sh"
postremove: "deployment/goreleaser/postremove.sh"
checksum:
algorithm: sha256
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

11
.woodpecker/release.yaml Normal file
View file

@ -0,0 +1,11 @@
steps:
- name: Release
image: golang:1.22.3
commands:
- go install github.com/goreleaser/goreleaser@latest
- goreleaser release
secrets: [ gitea_token ]
when:
event: tag
repo: gnouseu/spiegel
depends_on: []

View file

@ -1,4 +1,4 @@
clonedirectory = "archive/" clonedirectory = "/var/lib/spiegel/"
interval = 10 interval = 10
[log] [log]

View file

@ -0,0 +1,7 @@
if getent passwd spiegel > /dev/null; then
userdel -r spiegel
fi
if getent group spiegel > /dev/null; then
groupdel spiegel
fi

View file

@ -0,0 +1,12 @@
if ! getent group spiegel > /dev/null; then
groupadd -r spiegel
fi
if ! getent passwd spiegel > /dev/null; then
useradd -r -d /var/lib/spiegel -s /sbin/nologin -g spiegel -c "Spiegel server" spiegel
fi
if ! test -d /var/lib/spiegel; then
mkdir -p /var/lib/spiegel
chmod 0750 /var/lib/spiegel
chown -R spiegel:spiegel /var/lib/spiegel
fi

View file

@ -0,0 +1 @@
systemctl stop spiegel

View file

@ -0,0 +1,12 @@
[Unit]
Description=A light git repository mirror tools
After=network.target
[Service]
Type=simple
User=spiegel
ExecStart=/usr/bin/spiegel /etc/spiegel/config.toml
[Install]
WantedBy=multi-user.target