Files
SCM-Manager/scm-packaging/deb/build.gradle
2024-09-24 09:42:07 +02:00

185 lines
4.5 KiB
Groovy

/*
* Copyright (c) 2020 - present Cloudogu GmbH
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
import org.gradle.util.VersionNumber
plugins {
id 'nebula.ospackage' version '8.5.6'
id 'org.scm-manager.packaging'
id 'org.scm-manager.license'
}
configurations {
server
webapp
jsvc
packageYaml {
canBeConsumed = true
}
}
dependencies {
server project(':scm-server')
webapp project(path: ':scm-webapp', configuration: 'webapp')
}
task deb(type: Deb) {
packageName 'scm-server'
packageGroup 'devel'
summary 'SCM-Manager Server'
packageDescription 'The easiest way to share and manage your Git, Mercurial and Subversion repositories'
version expandedVersionWithDot
arch 'all'
priority 'extra'
maintainer 'SCM-Team <scm-team@cloudogu.com>'
packager 'SCM-Team <scm-team@cloudogu.com>'
uploaders 'SCM-Team <scm-team@cloudogu.com>'
url 'https://scm-manager.org'
requires 'adduser'
requires 'procps'
requires 'psmisc'
requires 'net-tools'
recommends 'openjdk-17-jre-headless'
recommends 'mercurial'
preInstallFile file('src/main/scripts/preinst')
postInstallFile file('src/main/scripts/postinst')
if (project.hasProperty("signing.keyId")) {
signingKeyId project.property("signing.keyId")
}
if (project.hasProperty("signing.password")) {
signingKeyPassphrase project.property("signing.password")
}
if (project.hasProperty("signing.secretKeyRingFile")) {
signingKeyRingFile file(project.property("signing.secretKeyRingFile"))
}
VersionNumber version = VersionNumber.parse(project.version)
from('src/main/bin') {
into '/opt/scm-server/bin'
user 'root'
permissionGroup 'scm'
fileMode 0750
}
from('src/main/fs/etc/default/scm-server') {
fileType CONFIG | NOREPLACE
into '/etc/default'
user 'root'
permissionGroup 'scm'
fileMode 0640
}
// https://github.com/nebula-plugins/gradle-ospackage-plugin/issues/118
configurationFile('/etc/default/scm-server')
from('src/main/fs/etc/scm') {
fileType CONFIG | NOREPLACE
into '/etc/scm'
user 'root'
permissionGroup 'scm'
fileMode 0640
expand([version: version])
}
// https://github.com/nebula-plugins/gradle-ospackage-plugin/issues/118
configurationFile('/etc/scm/config.yml')
from('src/main/fs/etc/systemd') {
into '/etc/systemd'
user 'root'
permissionGroup 'root'
fileMode 0644
}
from('src/main/fs/opt') {
into '/opt'
user 'root'
permissionGroup 'scm'
fileMode 0644
}
from(project.configurations.server) {
into '/opt/scm-server/lib'
user 'root'
permissionGroup 'scm'
fileMode 0644
}
from(project.configurations.webapp) {
into '/opt/scm-server/var/webapp'
user 'root'
permissionGroup 'scm'
fileMode 0644
rename {
'scm-webapp.war'
}
}
['/run/scm', '/var/log/scm', '/var/lib/scm', '/var/cache/scm', '/var/cache/scm/work'].each { dir ->
from('src/main/emptydir') {
into dir
user 'scm'
permissionGroup 'scm'
fileMode 0750
createDirectoryEntry true
}
}
link '/opt/scm-server/var/log', '/var/log/scm'
link '/opt/scm-server/conf', '/etc/scm'
link '/opt/scm-server/work', '/var/cache/scm/work'
}
task distribution(type: PackageYaml) {
type = 'debian'
dependsOn deb
}
artifacts {
packageYaml(file('build/libs/package.yml')) {
builtBy distribution
}
}
license {
header rootProject.file("LICENSE-HEADER.txt")
lineEnding = "\n"
tasks {
build {
files.from("build.gradle", "Vagrantfile")
}
main {
files.from("src")
}
}
}
task publish(type: HttpUploadTask) {
artifact deb
releaseUrl "https://packages.scm-manager.org/repository/apt-v2-releases/"
snapshotUrl "https://packages.scm-manager.org/repository/apt-v2-snapshots/"
if (project.hasProperty("packagesScmManagerUsername") && project.hasProperty("packagesScmManagerPassword")) {
username project.property("packagesScmManagerUsername")
password project.property("packagesScmManagerPassword")
}
dependsOn deb
}