Skip to content

Custom deployment rules

DK edited this page Sep 13, 2023 · 1 revision

This plugin template comes with a simple custom deployer script to enable custom deployment rules fitting most use cases.

To get started on adding custom deploy rules, check out the default examples.

rule

Each deployment rule is a json file of a sequence of actions. The rules are sorted on their file name, as shown in the File Explorer.

actions

action usage
base set variable params[0] with value params[1]
copy copy params[0] to params[1]
copy_if do copy if file exists
package add params[0..-1] list of sources to zip file params[-1]
remove remove params list of sources
script execute raw powershell script

The following base variables are provided by default:

cmake_output    // this is the binary output path
dist            // this is the dist folder path, also the working directory of deployer script
project_name    // project name same as CMakeLists
project_version // project version same as CMakeLists

examples (these are already included in template)

Add a new variable for other rules to use, e.g. set target_base variable to the Starfield/Data/SFSE/Plugins folder

{
    "action": "base",
    "params": [
        "{target_base}",
        "{env:SFPath}\\Data\\SFSE\\Plugins\\"
    ]
}

Copy all binary outputs to dist folder

{
    "action": "copy",
    "params": [
        "{cmake_output}\\*",
        "{dist}\\"
    ]
}

Copy .dll file from dist folder to Starfield/Data/SFSE/Plugins and copy .pdb file if present

{
    "action": "copy",
    "params": [
        "{dist}\\*.dll",
        "{target_base}"
    ]
},
{
    "action": "copy_if",
    "params": [
        "{dist}\\*.pdb",
        "{target_base}"
    ]
}

Copy configuration file used for plugin project from dist folder to Starfield/Data/SFSE/Plugins if present

{
    "action": "copy_if",
    "params": [
        "{dist}\\*.ini",
        "{target_base}"
    ]
},
{
    "action": "copy_if",
    "params": [
        "{dist}\\*.toml",
        "{target_base}"
    ]
},
{
    "action": "copy_if",
    "params": [
        "{dist}\\*.json",
        "{target_base}"
    ]
}

If your plugin project uses a configuration file, you should put them in dist folder, it will also be included in the visual studio project for easier editing and updating.

Package mod into zip file with versioning, only when built with Release or RelWithDebInfo, this will package .dll file, .pdb file(if present and RelWithDebInfo), any configuration file if present, and any manually added folders and files in dist/Data folder

{
    "action": "package",
    "config": "Release",
    "params": [
        "{dist}\\Data\\",
        "{dist}\\{project_name}.v{project_version}.zip"
    ]
},
{
    "action": "package",
    "config": "RelWithDebInfo",
    "params": [
        "{dist}\\Data\\",
        "{dist}\\{project_name}.v{project_version}.zip"
    ]
}

This will produce a nicely structured and ready to publish zip file for the mod.

Clone this wiki locally