<?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="4" />
		<description>
			The GitHub Release plug-in creates a component for each tagged version of a GitHub release.
		</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 downloads the archive to the 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. For 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 username to use to connect to the GitHub repository, if authentication is required." />
		</server:property>
		<server:property name="password" required="false">
			<server:property-ui type="secureBox"
				label="Password"
				description="The password to use to connnect to the GitHub Repository." />
		</server:property>
		<server:property name="downloadTarball">
			<server:property-ui type="checkBox"
				label="Download Tarball" description="Select to download a tarball of the source code." />
		</server:property>
		<server:property name="downloadZipball">
			<server:property-ui type="checkBox"
				label="Download Zipball" description="Select to download a zipball of the 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 property to
                          retain the execute permissions of each file." />
		</server:property>
		<server:property name="extensions">
			<server:property-ui type="textBox"
				label="Extensions of files to Convert"
				description="A list of file extension to be converted to a new Charset when downloaded. Separate each item with a comma. For example: 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 GitHub tag name. For example: - 20." />
    </server:property>
  </server:property-group>
</plugin>
