File woodpecker.spec of Package woodpecker

#
# spec file for package woodpecker
#
# Copyright (c) 2023 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/
#

%define components agent cli server
Name:           woodpecker
Version:        0.15.11
Release:        0
Summary:        CI system
Group:          Productivity/Other
License:        Apache-2.0
URL:            https://woodpecker-ci.org
Source0:        %{name}-%{version}.tar.gz
Source1:        vendor.tar.gz
Source2:        node_modules.tgz
Patch0:         web_vite.patch
BuildRequires:  golang-packaging
BuildRequires:  yarn

%description
Woodpecker is a community fork of the Drone CI system.

%package www
Summary:        Static web content for Woodpecker

%description www
Static web content for Woodpecker for serving using a webserver.

%package agent
Summary:       Woodpecker agent

%description agent
Woodpecker job executor and worker.

%package cli
Summary:      Woodpecker command line interface

%description cli
Tool for interacting with Woodpecker using a command line interface

%package server
Summary:      Woodpecker server

%description server
Main Woodpecker server

%prep
%autosetup -p1
%setup -DTqa2
mv node_modules web

%build
mkdir yarn-cache
pushd web
yarn --offline --cache-folder ../yarn-cache build
popd
for component in %{components}
do
	go build -mod=vendor -buildmode=pie -ldflags='-s -w -X github.com/woodpecker-ci/woodpecker/version.Version=%{version}' -o %{name}-$component github.com/woodpecker-ci/woodpecker/cmd/$component
done

%install
install -dm 0755 %{buildroot}%{_bindir} %{buildroot}%{_sbindir} %{buildroot}%{_sysusersdir} %{buildroot}%{_unitdir} %{buildroot}/srv/www
for component in %{components}
do
	install -vm 0755 %{name}-$component %{buildroot}%{_bindir}
done
cp -r web/dist %{buildroot}/srv/www/%{name}

%post
%postun

%clean
rm -fr /home/abuild/.cache

%files
%license LICENSE
%doc README.md CHANGELOG.md

%files agent
%{_bindir}/woodpecker-agent

%files cli
%{_bindir}/woodpecker-cli

%files server
%{_bindir}/woodpecker-server

%files www
/srv/www/%{name}

%changelog

openSUSE Build Service is sponsored by