Skip to content

Commit 15849c4

Browse files
committed
Add support for environment variables for upload tokens
1 parent 26a566e commit 15849c4

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,14 @@ To set a property, set `<name>_<property>` in `mod.properties` where `<name>` is
5555

5656
## Secrets
5757

58+
### Using a Secrets File
5859
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.
5960

61+
### Using Environment Variables
62+
If the corresponding keys are not found in the `secrets` file, ModUtils will check for the following environment variables:
63+
- `CURSEFORGE_UPLOAD_TOKEN` for CurseForge uploads.
64+
- `MODRINTH_UPLOAD_TOKEN` for Modrinth uploads.
65+
6066
## Mod properties
6167

6268
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.<name>` where `<name>` is the property name. To check, whether a property is present, use `'<name>' in mod`.

scripts/mod/upload_curse.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ String curseChangelog = mod.gitChangelog()
44
task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
55
if ('curse_auth' in secrets) {
66
apiToken = secrets.curse_auth.toString()
7+
} else if (System.getenv('CURSEFORGE_UPLOAD_TOKEN')) {
8+
apiToken = System.getenv('CURSEFORGE_UPLOAD_TOKEN')
79
} else {
810
apiToken = ''
911
}

scripts/mod/upload_modrinth.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ String modrinthChangelog = mod.gitChangelog()
44
modrinth {
55
if ('modrinth_auth' in secrets) {
66
token = secrets.modrinth_auth.toString()
7+
} else if (System.getenv('MODRINTH_UPLOAD_TOKEN')) {
8+
apiToken = System.getenv('MODRINTH_UPLOAD_TOKEN')
79
} else {
810
token = ''
911
}

0 commit comments

Comments
 (0)