<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed Materials - Property of IBM* and/or HCL**
- UrbanCode Deploy
- UrbanCode Build
- UrbanCode Release
- AnthillPro
- (c) Copyright IBM Corporation 2011, 2017. All Rights Reserved.
- (c) Copyright HCL Technologies Ltd. 2018, 2019. All Rights Reserved.
- U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by - GSA ADP Schedule Contract with IBM Corp.
- * Trademark of International Business Machines
- ** Trademark of HCL Technologies Limited
-->
<plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1"
	xmlns:server="http://www.urbancode.com/PluginServerXMLSchema_v1"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<header>
		<identifier id="com.urbancode.plugin.GitHubRelease" name="GitHub Release" version="2" />
		<description>
			The GitHub Release plugin Create component version for each GitHub release's tagged verison.
		</description>
		<tag>Source and Repositories/GitHub Release</tag>
		<server:plugin-type>Source</server:plugin-type>
	</header>
	<step-type name="Import Version">
		<description>Creates a new component version and allow download of archive to CodeStation.
		</description>
		<properties>
		</properties>
		<post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
		<command program="${JAVA_HOME}/bin/java">
			<arg value="-Dfile.encoding=${DS_SYSTEM_ENCODING}" />
			<arg value="-Dconsole.encoding=${DS_SYSTEM_ENCODING}" />
			<arg value="-jar" />
			<arg file="GitHubReleaseSourceConfig.jar" />
			<arg value="ImportVersion" />
			<arg file="${PLUGIN_INPUT_PROPS}" />
			<arg file="${PLUGIN_OUTPUT_PROPS}" />
		</command>
	</step-type>

	<!-- ==================================== -->
	<!-- Properties -->
	<!-- ==================================== -->
	<server:property-group type="Component"
		name="GitHubReleaseComponentProperties">
		<server:property name="githubRepoUrl" required="true">
			<server:property-ui type="textBox"
				label="GitHub Repository URL"
				description="The base URL of the repository on the GitHub. example - https://api.github.com/repos/ibm-datapower/datapower-configuration-manager" />
		</server:property>
		<server:property name="user" required="false">
			<server:property-ui type="textBox" label="User"
				description="The user name for the account that has access to GitHub Repo, if authentication is required." />
		</server:property>
		<server:property name="password" required="false">
			<server:property-ui type="secureBox"
				label="Password"
				description="The password for the account that has access to GitHub Repo, if authentication is required." />
		</server:property>
		<server:property name="downloadTarball">
			<server:property-ui type="checkBox"
				label="Download Tarball" description="Select to download tarball of source code." />
		</server:property>
		<server:property name="downloadZipball">
			<server:property-ui type="checkBox"
				label="Download Zipball" description="Select to download zipball of source code." />
		</server:property>
				<server:property name="saveFileExecuteBits">
			<server:property-ui type="checkBox"
				label="Preserve Execute Permissions"
				description="For Linux and UNIX operating systems, select this check box to
                          retain the execute permissions for each file." />
		</server:property>
		<server:property name="extensions">
			<server:property-ui type="textBox"
				label="Extensions of files to Convert"
				description="The comma separated list of extensions of compressed files which need to be
-                         converted to a new Charset on download (e.g. zip,tar.gz)."
				placeholder=".zip,.tar.gz" />
		</server:property>
	</server:property-group>

	<server:property-group type="Import" name="GitHubReleaseImportProperties">
    <server:property name="version" >
      <server:property-ui type="textBox"
                          label="GitHub Release Tag Name"
                          description="Import the specified GitHub tag name. For example - 20" />
    </server:property>
  </server:property-group>
</plugin>
