Command-Line Tools
What are Command-Line Tools?
PatchKit Command-Line Tools allow you to manage your applications from a command-line interface. This set of tools enables you to:
- Query information about your applications and versions
- Create new applications and versions
-
- Upload new version files
- Monitor the progress of new version processing
- Publish new versions
Using the tools provides two key benefits:
- Automation - for example, in the context of continuous integration or delivery.
- Faster uploads - you can upload locally computed binary differences instead of all application files.
Not all PatchKit plans include API access, which is required for the Command-Line Tools to work. To check if your account has API access, please visit your Account page.
Installation
To install the PatchKit Command-Line Tools, follow these steps:
- Download the latest version of the tools that match your operating system from GitHub.
- Unzip the file to a directory of your choice. We recommend
C:\patchkit_tools
on Windows and/opt/patchkit_tools
on Mac and Linux. - If you’re on Mac, execute
sudo xattr -r -d com.apple.quarantine /opt/patchkit_tools
to remove the quarantine attribute from the files. Otherwise, you’ll get an error when trying to run the tools. - Run it by double-clicking on the
StartTools
shortcut file on Windows or by executingpatchkit-tools
on Mac and Linux.
On Windows, if you’re already in the command line environment, you can run the tools directly using the patchkit-tools.bat
file, e.g., patchkit-tools.bat make-version
.
For more convenient usage, it is recommended to add the installation directory path to your PATH
environment variable. Find instructions for Windows, OS X, and Linux systems.
Upgrading
To upgrade (or downgrade) the tools to a different version, follow these steps:
- Remove the previous installation directory.
- Unzip the newly downloaded distribution from GitHub to the same location.
- On Mac, run
sudo xattr -r -d com.apple.quarantine INSTALLATION_PATH
to remove the quarantine attribute from the files.
Getting Started
To effectively use PatchKit, it’s important to have a basic understanding of the command line, whether it be Windows’ command line, Mac OSX’s Terminal, or Linux’s Terminal. Here are some resources to help you get started:
To use PatchKit’s tools, simply enter the following in the command line:
patchkit-tools tool-name [options,...]
To view a list of all available tools, run:
patchkit-tools --help
For specific information on a particular tool, such as the make-version
tool, use the following command:
patchkit-tools make-version --help
Note that many of PatchKit’s tools require you to provide an API key. You can find your API key on your account page.
Deploying an Application
To deploy an application with PatchKit, use the make-version
tool. This tool lets you create a new version of your application and upload the relevant files. Here’s how you can use it:
patchkit-tools make-version
The make-version
tool will prompt you for the following information:
- API key: your unique API key for accessing PatchKit services
- Application secret: the secret code associated with the specific application you want to deploy
- Version label: the name of the new version you’re creating
- Path to the files: the location of the directory that contains the files you want to upload
Please ensure that the directory you specify only contains the files you want to upload. The make-version
tool will automatically upload all files in the directory.
You can also provide this information as command-line arguments, like so:
patchkit-tools make-version -f C:\my_game -a API_KEY -s APP_SECRET -l 1.0
If you want to publish the version automatically after the upload is complete, you can use the -p
argument. Note that the publishing process will be cancelled if the upload or processing fails.
Working with Channels
To manage channels, follow the steps outlined in the Channels section.
-
Upload and Publish a Group Version: Use the
make-version
tool to upload and publish a group version. Provide your group secret as the application secret, which you can find on your group’s page.patchkit-tools make-version -a API_KEY -s GROUP_SECRET -l 1.0 -f PATH_TO_FILES -p
-
Link Group Version to a Channel: Use the
channel-make-version
tool to link the group version to a channel.patchkit-tools channel-make-version -a API_KEY -s CHANNEL_SECRET -l 1.0 --group-version GROUP_VERSION_ID
Replace
GROUP_VERSION_ID
with the ID of the group version created in the previous step.
You can automate linking the latest group version to a channel in your continuous integration system using the --latest-group-version
argument. This will find and link the most recent group version to the channel.
patchkit-tools channel-make-version -a API_KEY -s CHANNEL_SECRET -l 1.0 --latest-group-version
When using the make-version
tool with a group, the -p
flag persists the version for further use instead of publishing it. Only then you can then link the group version to a channel using the channel-make-version
tool.