#
# spec file for package autogits
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           autogits
Version:        0
Release:        0
Summary:        GitWorkflow utilities
License:        GPL-2.0-or-later
URL:            https://src.opensuse.org/adamm/autogits
Source:         autogits-%{version}.tar.zst
Source1:        vendor.tar.zst
BuildRequires:  golang-packaging
BuildRequires:  systemd-rpm-macros
BuildRequires:  zstd
%{?systemd_ordering}

%description
Git Workflow tooling and utilities enabling automated handing of OBS projects
as git repositories

%package -n gitea-events-rabbitmq-publisher
Summary:        Publishes Gitea webhook data via RabbitMQ

%description -n gitea-events-rabbitmq-publisher
Listens on an HTTP socket and publishes Gitea events on a RabbitMQ instance
with a topic
  <scope>.src.$organization.$webhook_type.[$webhook_action_type]

%prep
%autosetup -p1
cd gitea-events-rabbitmq-publisher && tar x --zstd -f %{SOURCE1}

%build
go build \
   -C gitea-events-rabbitmq-publisher \
   -mod=vendor \
   -buildmode=pie

%install
install -D -m0755 gitea-events-rabbitmq-publisher/gitea-events-rabbitmq-publisher  %{buildroot}%{_bindir}/gitea-events-rabbitmq-publisher
install -D -m0644 systemd/gitea-events-rabbitmq-publisher.service                  %{buildroot}%{_unitdir}/gitea-events-rabbitmq-publisher.service

%pre -n gitea-events-rabbitmq-publisher
%service_add_pre gitea-events-rabbitmq-publisher.service

%post -n gitea-events-rabbitmq-publisher
%service_add_post gitea-events-rabbitmq-publisher.service

%preun -n gitea-events-rabbitmq-publisher
%service_del_preun gitea-events-rabbitmq-publisher.service

%postun -n gitea-events-rabbitmq-publisher
%service_del_postun gitea-events-rabbitmq-publisher.service

%files -n gitea-events-rabbitmq-publisher
%license COPYING
%doc gitea-events-rabbitmq-publisher/README.md
%{_bindir}/gitea-events-rabbitmq-publisher
%{_unitdir}/gitea-events-rabbitmq-publisher.service

%changelog

