<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.camunda.community</groupId>
    <artifactId>community-hub-release-parent</artifactId>
    <version>1.2.2</version>
    <packaging>pom</packaging>

    <name>camunda community hub - Release Parent Pom</name>

    <description>
        This pom defines the required plugins and profiles to allow a camunda community hub release build.
        Inherit this pom when you want to use the camunda community hub GitHub release action.
    </description>

    <parent>
        <groupId>org.camunda</groupId>
        <artifactId>camunda-release-parent</artifactId>
        <version>3.9.1</version>
        <relativePath />
    </parent>

    <properties>
        <nexus.snapshot.repository.id>camunda-nexus</nexus.snapshot.repository.id>
        <nexus.snapshot.repository>https://app.camunda.com/nexus/content/repositories/camunda-bpm-community-extensions-snapshots</nexus.snapshot.repository>
        <nexus.release.repository.id>camunda-nexus</nexus.release.repository.id>
        <nexus.release.repository>https://app.camunda.com/nexus/content/repositories/camunda-bpm-community-extensions</nexus.release.repository>
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                    <plugin>
                        <!-- Pin version down to 2.5 to be able to run on JDK 17 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>2.5</version>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <attach>true</attach>
                                    <forceCreation>true</forceCreation>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.3.1</version>
                        <configuration>
                            <quiet>true</quiet>
                            <source>${version.java}</source>
                            <failOnError>false</failOnError>
                            <doclint>none</doclint>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>community-action-maven-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>oss-maven-central</id>
            <properties>
                <serverId>central</serverId>
                <nexusUrl>oss.sonatype.org</nexusUrl>
                <central.staging.deploy.id>${serverId}</central.staging.deploy.id>
                <central.staging.deploy.url>${nexusUrl}</central.staging.deploy.url>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <executions>
                            <!-- the execution default-deploy (defined in camunda-release-parent) deploys into camunda nexus -->
                            <!-- add additional execution to deploy to maven central -->
                            <execution>
                                <id>deploy-to-maven-central</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>deploy</goal>
                                </goals>
                                <configuration>
                                    <altStagingDirectory>${session.executionRootDirectory}/target/central-staging</altStagingDirectory>
                                    <detectBuildFailures>true</detectBuildFailures>
                                    <serverId>${central.staging.deploy.id}</serverId>
                                    <nexusUrl>${central.staging.deploy.url}</nexusUrl>
                                    <skipStaging>true</skipStaging>
                                    <skipNexusStagingDeployMojo>${skip.central.release}</skipNexusStagingDeployMojo>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <distributionManagement>
                <snapshotRepository>
                    <id>${central.staging.deploy.id}</id>
                    <url>${central.staging.deploy.url}/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>${central.staging.deploy.id}</id>
                    <url>${central.staging.deploy.url}/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
        </profile>
    </profiles>

</project>
