Skip to content

Create a .tpp package

Oddbjørn Bakke edited this page May 27, 2021 · 11 revisions

A TouchPortal plugin is deployed as a .tpp package. The .tpp extension is just a .zip file renamed.

Manual

Publish to folder and zip the folder, rename the extension. Simple as that.

Warning: Not all zip files are equal.
Some formats TP will tell was installed but nothing was, some formats needs a restart of TP to work, and some just works.

(checking plugin status in settings after install is a good idea)

Tools tested (Windows):

  • Not working: Windows Native ZIP
  • Not working: PowerShell Compress-Archive
  • Works partially: .Net / PowerShell System.IO.Compression

You will need to add a folder entry ex. archive.CreateEntry($"{directoryName}/");,
then create file entries as archive.CreateEntryFromFile(file, Path.Combine(directoryName, Path.GetFileName(file)));.
If the directory entry is not created, the plugin will not install. See Zipping and Unzipping in Java for example of the issue in Java Zip.

  • Works partially: tar -acf out.zip foldername
  • Works: 7-Zip

7-Zip with it's zip defaults works best, and is recommended.

In this package, you would like to have root folder, don't put you plugin files at root.

.tpp
|-PluginName
  |-entry.tp
  |-PluginName.exe
  |-...

Theese files will be installed to %appdata%\TouchPortal\plugins, this is why you need that extra folder on root. If you install your plugin, then the folder above should include a folder with the plugin name.

GitHub Actions Pipelines

For github action pipelines, it would be something like (using dotnet core type csproj):

name: .NET

on:
  push:
    tags:
      - "v*"

jobs:
  build:

    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 5.0.x
    - name: Restore dependencies
      run: dotnet restore
    - name: Build
      run: dotnet build --no-restore
    - name: Test
      run: dotnet test --no-build --verbosity normal
    - name: Publish
      run: dotnet publish -c Release -o publish\PluginName #Replace PluginName to something else.
    - name: Archive
      shell: bash
      run: 7z a -tzip "PluginName.tpp" "./publish/*" #Replace PluginName to something else.
    - name: Release
      uses: softprops/action-gh-release@v1
      if: startsWith(github.ref, 'refs/tags/')
      with:
        files: PluginName.tpp #Replace PluginName to something else.
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

This will build, publish and create a package under Releases in github, every time you tag a commit with a tag starting on v. Ex. v1, v2, v3 etc.

This example is taken from TouchPortal.Plugin.HotKey and TouchPortal.Plugin.AudioMonitor (also has pre-release pipeline).
And therefor uses windows-latest, but you can use linux if you want. Feedback and other suggestions are welcome.

Clone this wiki locally