<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>com.github.leonardo-couto</groupId>
  <artifactId>nodejs-binaries</artifactId>
  <version>7.5.0</version>
  <packaging>pom</packaging>
  <name>nodejs-binaries</name>
  <description>Node.js Binaries as a Maven dependency</description>
  <url>http://github.com/leonardo-couto/nodejs-binaries</url>

  <properties>
    <node.version>7.5.0</node.version>
  </properties>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh-snapshot</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:ssh://git@github.com/leonardo-couto/nodejs-binaries.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/leonardo-couto/nodejs-binaries.git</developerConnection>
    <url>https://github.com/leonardo-couto/nodejs-binaries</url>
    <tag>nodejs-binaries-7.5.0</tag>
  </scm>

  <developers>
    <developer>
      <name>Leonardo Couto</name>
      <email>leonardo.couto@gmail.com</email>
    </developer>
    <developer>
      <name>Guilherme Murari</name>
      <email>gui_mfmurari@hotmail.com</email>
    </developer>
  </developers>

  <build>
    <plugins>

      <plugin>
        <groupId>com.googlecode.maven-download-plugin</groupId>
        <artifactId>download-maven-plugin</artifactId>
        <version>1.2.0</version>
        <executions>
          <execution>
            <id>download-linux-x64</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>wget</goal>
            </goals>
            <configuration>
              <url>http://nodejs.org/dist/v${node.version}/node-v${node.version}-linux-x64.tar.gz</url>
              <outputFileName>${project.build.finalName}-linux-x64.tar.gz</outputFileName>
            </configuration>
          </execution>
          <execution>
            <id>download-macos-x64</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>wget</goal>
            </goals>
            <configuration>
              <url>http://nodejs.org/dist/v${node.version}/node-v${node.version}-darwin-x64.tar.gz</url>
              <outputFileName>${project.build.finalName}-macos-x64.tar.gz</outputFileName>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.8</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}-linux-x64.tar.gz</file>
                  <type>tar.gz</type>
                  <classifier>linux-x64</classifier>
                </artifact>
                <artifact>
                  <file>${project.build.directory}/${project.build.finalName}-macos-x64.tar.gz</file>
                  <type>tar.gz</type>
                  <classifier>macos-x64</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
        <configuration>
          <releaseProfiles>deploy</releaseProfiles>
        </configuration>
      </plugin>

    </plugins>
  </build>
  
  <profiles>
    <profile>
      <id>deploy</id>
      <activation>
        <property>
          <name>deploy</name>
        </property>
      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
