diff --git a/README.md b/README.md index dfc2f0d..05ac2b4 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,14 @@ To set a property, set `_` in `mod.properties` where `` is ## Secrets +### Using a Secrets File ModUtils will look for a file named `secrets.properties` (the location can be changed with the environment variable `SECRET_PROPERTIES`) and load those properties into a global object named `secrets`. The keys for mod uploading are expected as `curse_auth` or `modrinth_auth` in that secret object. +### Using Environment Variables +If the corresponding keys are not found in the `secrets` file, ModUtils will check for the following environment variables: +- `CURSEFORGE_UPLOAD_TOKEN` for CurseForge uploads. +- `MODRINTH_UPLOAD_TOKEN` for Modrinth uploads. + ## Mod properties The properties defined in `mod.properties` will be placed in a global object named `mod`. Also some other properties will be added to this. All `mod` properties can be found below. (Non-bold properties may be absent). A property can be accessed with `mod.` where `` is the property name. To check, whether a property is present, use `'' in mod`. diff --git a/scripts/mod/upload_curse.gradle b/scripts/mod/upload_curse.gradle index 1e430b9..c5f131e 100644 --- a/scripts/mod/upload_curse.gradle +++ b/scripts/mod/upload_curse.gradle @@ -4,6 +4,8 @@ String curseChangelog = mod.gitChangelog() task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) { if ('curse_auth' in secrets) { apiToken = secrets.curse_auth.toString() + } else if (System.getenv('CURSEFORGE_UPLOAD_TOKEN')) { + apiToken = System.getenv('CURSEFORGE_UPLOAD_TOKEN') } else { apiToken = '' } diff --git a/scripts/mod/upload_modrinth.gradle b/scripts/mod/upload_modrinth.gradle index 4eec149..e25a039 100644 --- a/scripts/mod/upload_modrinth.gradle +++ b/scripts/mod/upload_modrinth.gradle @@ -4,6 +4,8 @@ String modrinthChangelog = mod.gitChangelog() modrinth { if ('modrinth_auth' in secrets) { token = secrets.modrinth_auth.toString() + } else if (System.getenv('MODRINTH_UPLOAD_TOKEN')) { + apiToken = System.getenv('MODRINTH_UPLOAD_TOKEN') } else { token = '' }