Jump to content

WeiDU Mod Packager - A customizable GitHub Action to automate the creation of mod packages


Recommended Posts

Posted (edited)

Project: https://github.com/InfinityTools/WeiduModPackager

Overview

WeiDU Mod Packager is a highly customizable GitHub Action that can be used to automate the creation of mod packages. Like AL|EN's Infinity Auto Packager it automatically creates PI-specific iemod files and/or platform-specific zip archives whenever a new mod release is published, but also offers a great number of options to customize the resulting mod packages.

The project provides many predefined GitHub Action scripts that cover most use cases and can be used as is. Alternatively, you can create your own script or adapt any of the predefined scripts to your need. An example script with detailed descriptions of all available parameters can be found in the packager's readme.

Features

  • Create iemod packages, platform-specific zip archives for Windows, Linux or macOS, or multi-platform packages which include setup files for all supported platforms in a single archive.
  • Control which WeiDU setup binary to include in the mod packages. You can define WeiDU version and architecture for each platform.
  • Specify how to determine the filename of the mod package. Use the same name as the mod's .tp2 file, fetch the name from the associated PI metadata ini file, or specify a custom package name.
  • Specify how to determine the version suffix for the mod package. Fetch the version number from the .tp2 script's VERSION definition, use the GitHub tag name, or specify a custom string.
  • Several more customizations, such as specifying name prefixes for platform-specific zip archives or auto-update behavior of setup scripts in multi-platform mod packages.

How to use

The project contains several preconfigured workflows for use in your own mods. To do this:

  1. Select the desired branch from the dropdown list on the GitHub project page. A summary of all available templates is listed in the packager's readme.
  2. Download the code by clicking on Code > Download ZIP.
  3. Unpack the downloaded zip file and copy the ".github" folder to the root folder of your own mod project.

Alternatively:

  1. Select "Add file" > "Create new file" on the main page of your own mod on GitHub.
  2. Enter .github/workflows/WeiduModPackager.yml into the filename input field (do not skip the leading dot in ".github").
  3. Copy-paste the content of the ".github/workflows/WeiduModPackager.yml" script from the unpacked zip file into the text area.
  4. Finally, commit the changes to your project.

The action is automatically invoked whenever a new release is published. It can take a few moments for the mod packages to appear on the release page. Details about the mod package generation process can be inquired on the "Actions" page of the GitHub project.

Note: Make sure the project has the required permissions in the project's Settings > Actions > General. Permissions should be set to "Allow all actions and reusable workflows".

Edited by argent77
Posted

This sounds impressive and I can see the advantages over AL|EN's already very great tool. (For me, the possibility to name the mod package would be the reason to switch).

Unfortunately, I'm very slow with chaning solutions that work (and AL|EN's mod packager works great), so I only added bookmark for now.

Still, thank you very much for your continuous work on improving the modding infrastructure - and doing it besides your own mod projects!

Posted

Tested this out and it works pretty good.
These are just a few suggestions:

- Add option for this naming scheme:  modname-version-OS-extra
- Add option to make the filenames entirely lower case.
- Add option to replace colons (:) with nothing, instead of an underscore. (so BG:EE in the modname in ini file becomes "bgee" instead of "BG_EE")

Posted
17 minutes ago, Dan_P said:

- Add option for this naming scheme:  modname-version-OS-extra
- Add option to make the filenames entirely lower case.
- Add option to replace colons (:) with nothing, instead of an underscore. (so BG:EE in the modname in ini file becomes "bgee" instead of "BG_EE")

Good ideas. I'll see what I can do.

Posted
On 10/22/2024 at 11:27 PM, Dan_P said:

- Add option for this naming scheme:  modname-version-OS-extra

The packager action now provides a parameter to specify a format string for package name generation. This parameter is very powerful and allows to define custom mod package names very easily.

From the readme:

Quote

The parameter "name_fmt" defines the format of the mod package name. It supports placeholder variables that can be placed into individual groups together with optional literal strings to form the resulting package name.

Groups are delimited by angle brackets (<group content>). Placeholder variables are delimited by percentage signs (%placeholder%). Any characters outside of groups are preserved in the resulting mod package name.

A group is discarded completely if the placeholder variables in the group are empty. A group without placeholder variables is always considered empty and will be discarded.

To use percent characters literally you have to escape them with a backslash character (\%). Note that only the percentage sign is preserved. Angle brackets are considered invalid filename characters and are replaced by the standard placeholder character.

Supported placeholder variables:

  • type: Specifies the package type (as defined by the "type" parameter).
  • arch: Specifies the architecture of the WeiDU binary (as defined by the "arch" parameter). This variable is empty for iemod package types.
  • os_prefix: Specifies the platform-specific prefix (as defined by the "prefix_win", "prefix_lin", and "prefix_mac" parameters). This variable is empty for "iemod" and "multi" package types.
  • base_name: Specifies the base name of the mod package without any prefix or suffix (as defined by the "naming" parameter).
  • extra: Specifies the content of the "extra" parameter.
  • version: Specifies the version string (as defined by the "suffix" parameter).

Unsupported placeholder variables are resolved to empty strings.

Default string for name_fmt: <%os_prefix%-><%base_name%><-%extra%><-%version%>

 

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...