<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2000 - 2024 Silverpeas

    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, either version 3 of the
    License, or (at your option) any later version.

    As a special exception to the terms and conditions of version 3.0 of
    the GPL, you may redistribute this Program in connection with Free/Libre
    Open Source Software ("FLOSS") applications as described in Silverpeas's
    FLOSS exception.  You should have received a copy of the text describing
    the FLOSS exception, and it is also available here:
    "https://www.silverpeas.org/floss_exception.html"

    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/>.

-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <packaging>jar</packaging>
  <groupId>org.silverpeas</groupId>
  <artifactId>silverpeas-distribution</artifactId>
  <version>6.4.7-build260305</version>
  <name>Distribution of Silverpeas ${project.version}</name>
  <description>
    It generates a distribution of Silverpeas ${project.version} for both Unix-like and Windows
    systems.
  </description>

  <scm>
    <developerConnection>scm:git:git@github.com:Silverpeas/Silverpeas-Distribution.git</developerConnection>
    <connection>scm:git:git@github.com:Silverpeas/Silverpeas-Distribution.git</connection>
    <url>https://github.com/Silverpeas/Silverpeas-Distribution.git</url>
    <tag>HEAD</tag>
  </scm>

  <repositories>
    <repository>
      <id>Silverpeas</id>
      <layout>default</layout>
      <name>Silverpeas Repository</name>
      <url>https://nexus3.silverpeas.org/repository/silverpeas</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <distributionManagement>
    <repository>
      <id>silverpeas</id>
      <name>Repository Silverpeas</name>
      <layout>default</layout>
      <url>https://nexus3.silverpeas.org/repository/releases/</url>
    </repository>
    <snapshotRepository>
      <id>silverpeas-snapshots</id>
      <name>Snapshots Repository Silverpeas</name>
      <layout>default</layout>
      <url>https://nexus3.silverpeas.org/repository/snapshots/</url>
    </snapshotRepository>
    <site>
      <id>silverpeas_repository</id>
      <url>scp://www.silverpeas.org/var/www/docs</url>
    </site>
  </distributionManagement>

  <properties>
    <!-- property used by the CI to both deploy a build version and release the next stable version -->
    <next.release>6.4.7</next.release>
    <server.distribution>wildfly26</server.distribution>
  </properties>

  <build>
    <finalName>silverpeas-${project.version}-${server.distribution}</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.5.0</version>
        <executions>
          <execution>
            <id>package-distribution</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>${project.basedir}/src/main/resources/assembly.xml</descriptor>
              </descriptors>
              <escapeString>''</escapeString>
              <appendAssemblyId>false</appendAssemblyId>
              <attach>false</attach>
              <skipAssembly>false</skipAssembly>
              <finalName>${project.build.finalName}</finalName>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>wagon-maven-plugin</artifactId>
        <version>2.0.2</version>
        <executions>
          <execution>
            <id>upload-package</id>
            <phase>install</phase>
            <goals>
              <goal>upload</goal>
            </goals>
            <configuration>
              <serverId>silverpeas_repository</serverId>
              <fromDir>${project.basedir}/target</fromDir>
              <includes>*.zip,*.zip.asc</includes>
              <excludes>pom.xml</excludes>
              <url>scp://${scp.user}@www.silverpeas.org</url>
              <toDir>/var/www/files</toDir>
              <optimize>true</optimize>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ssh</artifactId>
            <version>3.5.3</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.3.0</version>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.directory}/${project.build.finalName}.zip</file>
                  <type>zip</type>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>3.0.1</version>
        <configuration>
          <keyname>${gpg.keyname}</keyname>
          <passphraseServerId>${gpg.keyname}</passphraseServerId>
          <gpgArguments>
            <arg>-a</arg>
            <arg>-b</arg>
          </gpgArguments>
        </configuration>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>pl.project13.maven</groupId>
        <artifactId>git-commit-id-plugin</artifactId>
        <version>4.9.10</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>revision</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
          <dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
          <generateGitPropertiesFile>false</generateGitPropertiesFile>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.3.0</version>
        <configuration>
          <archive>
            <manifestEntries>
              <Build-Version>${project.version}</Build-Version>
              <Git-Commit>${git.commit.id.abbrev}</Git-Commit>
              <Build-Timestamp>${maven.build.timestamp}</Build-Timestamp>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
