Publishing a script on the BDN

Tutorial explaining how to publish a script to the BDN. This tutorial is focussed on Script Writers of Parabot.

NOT FINISHED YET!

A detailed Step-by-step guide

Creating a repository

  1. You'll first have to create a Git repository. In this example we will use git.parabot.org as our provider (all script writers have access to this provider).

  2. Once we have created the repository, we can push code to the repository.
  3. As we use Maven to produce scripts, your script has to have the Maven framework. The pom.xml must have a few properties and must have the build tag as displayed in the file below.
    If you want to keep it easy for yourself, you could also just copy this file and overwrite your current pom.xml file.

     pom.xml
    pom.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <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.parabot.scripts</groupId>
        <artifactId>my-script</artifactId>
        <version>1.0</version>
    
        <properties>
            <script.id>SCRIPT_ID</script.id>
    
            <jdk.version>1.7</jdk.version>
            <buildType.id>SCRIPT_${script.id}</buildType.id>
        </properties>
    
        <repositories>
            <repository>
                <id>parabot-maven</id>
                <name>Parabot its Maven Repository</name>
                <url>https://maven.parabot.org/</url>
            </repository>
        </repositories>
    
        <dependencies>
            <dependency>
                <groupId>org.parabot</groupId>
                <artifactId>client</artifactId>
                <version>2.6.6.5</version>
            </dependency>
            <dependency>
                <groupId>org.parabot</groupId>
                <artifactId>317-api-minified</artifactId>
                <version>1.21.3</version>
            </dependency>
        </dependencies>
    
        <build>
            <finalName>${buildType.id}</finalName>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                    <includes>
                        <include>config.xml</include>
                    </includes>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>false</filtering>
                    <excludes>
                        <exclude>config.xml</exclude>
                    </excludes>
                </resource>
            </resources>
    
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>${jdk.version}</source>
                        <target>${jdk.version}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <excludes>
                            <exclude>src/main/resources/config.xml</exclude>
                        </excludes>
                        <outputDirectory>${project.build.directory}/final/</outputDirectory>
                    </configuration>
                </plugin>
    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.8</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <configuration>
                                <target>
                                    <ant antfile="${basedir}/src/main/resources/build.xml">
                                        <target name="allatori"/>
                                    </ant>
                                </target>
                            </configuration>
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
  4. Now that you have the pom.xml filled, you'll also need two other xml files.
    Create a build.xml file in src/main/resources and fill it with the following content:

     build.xml
    build.xml
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <project name="allatori">
        <target name="allatori">
            <taskdef name="allatori" classname="com.allatori.ant.ObfuscatorTask" classpath="${user.home}/allatori/allatori.jar"/>
            <allatori config="src/main/resources/config.xml"/>
            <echo message="Obfuscating script"/>
        </target>
    </project>
  5. The second file you'll need to add is config.xml.
    Create a config.xml file in src/main/resources and fill it with the following content:

     config.xml
    config.xml
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <config>
        <jars basedir="${basedir}/target/final/">
            <jar in="${buildType.id}.jar" out="${buildType.id}.jar"/>
        </jars>
    
        <!-- String encryption -->
        <property name="string-encryption" value="enable"/>
        <property name="string-encryption-type" value="fast"/>
        <property name="string-encryption-version" value="v4"/>
    
        <!-- Control flow obfuscation -->
        <property name="control-flow-obfuscation" value="enable"/>
        <property name="extensive-flow-obfuscation" value="normal"/>
    
        <!-- Renaming -->
        <property name="default-package" value=""/>
        <property name="force-default-package" value="disable"/>
    
        <property name="classes-naming" value="unique"/>
        <property name="methods-naming" value="iii"/>
        <property name="fields-naming" value="iii"/>
        <property name="local-variables-naming" value="abc"/>
    
        <!-- Other -->
        <property name="line-numbers" value="keep"/>
        <property name="generics" value="keep"/>
        <property name="member-reorder" value="enable"/>
        <property name="finalize" value="disable"/>
        <property name="synthetize-methods" value="private"/>
        <property name="synthetize-fields" value="private"/>
        <property name="remove-toString" value="disable"/>
    
        <watermark key="support@parabot.org" value="Compiled and obfuscated by Parabot"/>
    </config>
  6. Now you can push the code to the repository.

  7. The last step is to add a deploy key to the repository.
    In git.parabot.org you can simply do this by going into the project settings, then going to Deploy Keys and then hitting Enable on the TeamCity key:

     View

    If you're not using git.parabot.org, then you can copy the public Deploy Key below and add this through the relevant page for your provider.

     Public Deploy Key
    Public Deploy Key
    ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAo3YbeBV7mTaN3s2vwm3RCO8f/UvWs8HGoZ7IeyBPsV3D0Bwo9vRtGYlqpMIuIOWqZAl/HWNqVry719pzvnRPBArOAEn/aEhJLs4L5QJ+6YdRCsXqZCz6d78dAT4NUwxJTvpv11Bw/JLBEkL7A2wYTuNokzgWlSZSE3DOQHc1hn7TP22cpOCTM2HKixAcCD1zeU+wUlnYRFj+5jB8MumCepqAzeULv9bfh7IZL3CL3vcuprxAn6ANFX6Nd6cjILJgjhszgxNWlnrAlsc2uBuijU61mguyxJLLtK5U5Qyfx8lBoxs92l2ChzwwH6yPUbUx08dFpbTO7VuRSWLBD8DP2tHgMmrBTe+/c6nItCVO9rYKiSQjnIw3VnFzTsqMwAtJJwy11GEAWAl7BHMng5Ypm1Opjd0Yc6co3oe7tzd3fzmpSI6jGTgchFimJ8o++YuMrZuA01DBDcCV1n8ydLBz6AYoaPRYEv+MfH/uNrje2EzNWqUm6dV0GQj3pEu/JD61JbmhLvz9YqKPjGC8wJNi9pqrRkZN5FJON1KEzGksO/1Q4YtTld8IPcbm1t8GfBsUPslNE8EWAbD6i3Zk9ILWFrodEDOeaFL7pNVSELA1EozzTf4cjYYTNT0SGQGzjD2RgmT3gK/gPPlazsfgkgJI3tpDDF/UlZO4m4HzF6x4jj8= jetbrains@parabot.org
  8. You're now ready to publish the script on the BDN.

Publishing the script on the BDN

  1. Now go to the BDN V3 control panel and add your script.

     View
  2. Fill in the name and the description of the script. You could also assign a forum ID to the script, whereas this is the ID on the forums of Parabot.
    The Git URL is the Git URL you can find in your script, you should have uploaded to git.parabot.org, in this example the Git URL is git@git.parabot.org:JKetelaar/example-script.git.
    We'll keep the Authors as it is, but you could fill in another Script Writer in here, so that person is able to edit the script.
    For Groups we'll choose "Sponsor" in this example and for Category we'll choose "Other" in this example.

     View

  3. Once you have submitted/saved the script, open your script and you'll see a "Add build project" on the right top. Once you click on this, it will reload the page and you'll see two new buttons.

  4. A unique ID has now been generated for you, which you can find on the information page of your script.

     View

  5. This ID needs to be filled in, in the pom.xml file. If you open the pom.xml file, you'll see a property called script.id, this is where you have to fill in this ID.

     View

    To

  6. Make sure to push this change to the repository and then go back to the BDN.
  7. Click on Builds on the right top and wait for the page to load.

     View

  8. Now click on Build on the right top. After you clicked it, a message should appear that this action is initiated. You should also see a message appear in the Slack channel #deployments.

     View

  9. After a few minutes, you can reload this page and it will show a new line with (hopefully) a success label.
    This means the build succeeded and everything is ready for a new release.

     View

  10. When you now go back to your script page, you can make a new release of the latest build.
    Do this by clicking the Release button.

     View

  11. Here you can fill in a version for your new release and a description to let your script users know what has been changed.

     View

If you'd like to release a new version of your script, you have to repeat step 7 till 11.

Please contact an administrator if you cannot figure out how to complete this or if you're facing any errors.
You can contact an administrator through Slack.