ModRelease - create new GitHub Release from commandline
ALIEN
Member Posts: 1,271
Hi,
A tool for creating a new GitHub Release from the command line!
Features:
Prerequisites:
Software Requirements:
Installation:
Reference of the proper folder structure:
Usage:
Feedback/questions/comments are welcome.
A tool for creating a new GitHub Release from the command line!
Features:
- can be combined with Infinity Auto Packager tool
- cross-platform, single code for Windows, macOS, and Linux
- release version (tag) is taken directly from tp2 file "VERSION" keyword
- prevent creating a "2.0.0" release when your mod version is "1.9.0"
- prevent creating new release if the same release already exist
- prevent creating new release if there are uncommitted file modifications
- release description can be edited before creating a new release
- initial release description is generated from commit messages between the new release and previous release
Prerequisites:
- GitHub account
- Github Personal Access Token" with "public_repo" privilege
- read Git and GitHub tutorial
- locally cloned mod repository
Software Requirements:
- GitHub Desktop or Git
- additionally only for Windows 7/8.1 - either .NET Framework 4.5.2+ and PowerShell 5.1 or PowerShell 6
- additionally only for macOS, Linux - PowerShell 6
Installation:
- Download and extract ModRelease repository, move everything from 'ModRelease-master' folder directly into the folder where you keep all cloned top-level mod folders.
- Create new "Personal Access Token" with "public_repo" privilege, it's not your password, you can revoke it at any time, more info here.
- Save it to "#ModRelease-Github-Key-Example.txt" file and rename it to #ModRelease-Github-Key.txt
- Put #ModRelease.bat/#ModRelease.command inside the top-level directory of the mod's cloned Github repository, it's where WeiDU executable should be, use the included mod example as reference.
Reference of the proper folder structure:
- Red - #ModRelease folder and #ModRelease.bat/#ModRelease.command files location
- Yellow - top-level folder of the local repository
- Green - .git folder location inside local repository
Usage:
- Assuming that all mod files are ready for a new release, increase mod version inside mod readme and mod tp2 file.
- Create a new commit with all modified files. Do not create a new tag for release, the tag itself will be created automatically (from mod "VERSION" keyword) and pushed into an online repository.
- Run #ModRelease.bat (Windows) | #ModRelease.command (Mac) | #ModRelease.sh (Linux) and follow further instructions.
Feedback/questions/comments are welcome.
Post edited by ALIEN on
1
Comments
But I have a lot of ignorance when it comes to GitHub.
How about extra features like:
-checks "VERSION" keyword and make sure that you don't create '2.1.3' release when you mod version is actually '2.1.1' - done
-creating mod archive: modname-version.zip and upload it into release as 'Assets', you can see examples here - done
-ability to read "changelog.md" file in order to insert changes from last version directly into release description
- I don't have the knowledge necessary to judge the importance of this
- Lovely!
I'm on macOS and my mod is composed of:
I generated a personal access token and saved it to '#ModRelease-Github-Key.txt'.
After that, I moved '#ModRelease.bat' from your 'ExampleMod' folder to my mod, so now I have 3 files:
What am I supposed to do now exactly?
Sorry, forget about .bat files, those are for Windows OS. I've added missing "#ModRelease.command" file for Mac. I also made some improvements so you need to re-download whole repository again and overwrite #ModRelease.ps1 file.
Now, when you ready with you release ( read 'Usage' paragraph ), simply run "#ModRelease.command" file and follow instruction.
P.S. Probably tomorrow, I will add a nice GUI where you can edit release description, instead of the limited one-line commandline.
When running "#ModRelease.command", I get the following error:
My repository consists of:
Am I missing something?
In any case I'm given the possibility to continue:
So, what's wrong now?
Yes, first release.
Moreover, I also received the following communication from Github:
As a precautionary measure, we have revoked the OAuth token. A new token will need to be generated in order to continue using OAuth to authenticate to GitHub."
I mean, that's weird since I didn't do anything in the end....
You did but not via this script:
I missed the fact that you put two folders into repository, this is wrong, repository should only contains you mod files + "#ModRelease.command".
Example:
Red - ModRelease folder and "#ModRelease.command" location
Yellow - Repository top-level folder
Green - .git folder location
Now it's clear why you received this message: you committed "#ModRelease-Github-Key.txt" file into online repository by mistake. As a security feature, Github blocked this API key. You need to move "#ModRelease" folder outside the local git repository (see example ), recreate new API key and put it into #ModRelease-Github-Key.txt.
I see, I will fix error messages. You can create initial release, next time you should't see errors.
It seems to work fine now, thanks
P.S. There is no need for 3 separate packages instead of one universal mod package which simultaneously supports Windows, macOS and Linux.
OK, so your "#ModPackage" script will allow to generate this universal mod package? I'll wait for it then...
A. Package the mod as .iemod + don't include weidu: you basically forces the players to use mod managers (unlike other games not many other games require them) and you need to include explanation, something like: 'if you don't want to use mod manager, simply rename it to zip and extract the content of this file to game dir, also download copy of the weidu, rename it to setup-mymod/.exe and run from game directory', no double-click feature for macOS right now (unless you manually associate file type)
B. Package the mod as .iemod + include weidu: you basically forces the players to use mod managers (unlike other games not many other games require them) and you need to include explanation, something like: 'if you don't want to use mod manager, simply rename it to zip and extract the content of this file to game dir', no double-click feature for macOS right now (unless you manually associate file type)
C. Package the mod as .zip and include weidu: no double-click feature for mod manager, double-click works for macOS and Windows
D. Two separate packages: first: .iemod without weidu, second .zip with weidu
I was thinking of something like this:
See? Source code + Windows + macOS + Linux.
What do you think?
OK, let's try....
So, the zip version will contain both setup-mymod.exe and setup-mymod.command (i.e., both Windows and Unix WeiDU executables)?
OK, proceed then.... Once you're done with your update, I'll test it...
I don't understand the reference to Applescript, do you mean that for .zip package, I should replace .command files with "MacOS Weidu Launcher" as replacement for them?
Also, I'm interested in any kind of solution which improves user/player experience on macOS.
- the idea of the application is good but ... why you also included this inside all of you mod packages instead of simply telling people that 'you need one time download of "Mac Weidu Launcher"?
- it creates a symlink (alias) inside game directory so there will be 41 items after installing 20 mods but anyway, the pollution of main game directory can't be avoided
- you choose to name WeiDU executable as "weidu", every time when a Linux user will extract one of you mod, it will break his 'weidu' executable
- iemod packages are for mod files only, if it would be included into zip package (not the same as github "Download" zip because it has extra dir) it causes "overwrite files" question, which would spike infinite amount of "Should I overwrite files or not" from new players.
It seems to me that while it has some benefits, it also has flaws. Are you interested in changing the app in order to overcome some of them?
Regarding 'burden for players' - it's only one 'extra' thing to download (same as one extra mod), requirements to use mod managers are totally normal thing for 90% of games. No one will complain that he need to download and use mod manager if it is in fact the easiest way to install mods.
Well, there is one more issue with the concept of setup-modname.app:
Mac OS Mojave, after launching .app:
- first window with confirmation:
- after clicking "OK" another window for confirmation:
then finally console appears.
And from what I've found, there is no way to avoid it (please correct me if I'm wrong, I'm not familiar with macOS at all) thus .command files still have one advantage of not requiring such confirmation (if using 'setup-modname' approach, I'm much more of a fan of separate 'mod manager')