Skip to content

Commit

Permalink
fix: add optional repo input to fix category issue (#25)
Browse files Browse the repository at this point in the history
* fix: add workaround to category issue

* fix: fix formatting for one elif branch

* fix: accept all whitespace as delimiter in categorirs

* chore: update docs

* fix: use nullish coalescing correctly
  • Loading branch information
AnActualEmerald authored Nov 21, 2023
1 parent 882e48e commit 567c294
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
On your mark, get ready, start.
version: v0.${{ github.run_number }}.0
community: test # needs to be test for thunderstore.dev
repo: thunderstore.dev
wrap: mods
website: "https://greenboi.me"
categories: |
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
name: test # the name of the package
version: $GITHUB_REF_NAME # Use the tag as the package version
community: Northstar
repo: northstar.thunderstore.io
categories: | # <-- notice this pipe character
Foo
bar-baz
Expand Down Expand Up @@ -80,6 +81,7 @@ curl -X GET "https://thunderstore.io/api/experimental/community/northstar/catego
| `token` | Service account token from Thunderstore. Should be saved as a repo secret and accessed with `${{ secrets.YOUR_TOKEN_NAME }}` | `true` |
| `community` | Thunderstore community to publish to. | `true` |
| `namespace` | Name of the team to publish under. | `true` |
| `repo` | URL or hostname of the repository to publish to (see [#22](https://github.com/GreenTF/upload-thunderstore-package/issues/22)). | `false` |
| `name` | Name of the package. | `true` |
| `description` | Description of the package that will appear on Thunderstore. | `true` |
| `version` | Package version in SemVer format. | `true` |
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ inputs:
description: 'Is the mod NSFW'
file:
description: 'Prebuilt .zip file to use, relative to the repo root'
repo:
description: 'The URL of the thundertore repo to publish to'
outputs:
url:
description: 'URL of uploaded mod'
Expand All @@ -67,3 +69,4 @@ runs:
TS_DEPS: ${{ inputs.deps }}
TS_NSFW: ${{ inputs.nsfw }}
TS_FILE: ${{ inputs.file }}
TS_REPO: ${{ inputs.repo }}
5 changes: 4 additions & 1 deletion cfg_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ const name = Deno.env.get("TS_NAME");
const version = Deno.env.get("TS_VERSION").replace(/v/g, '');
const desc = Deno.env.get("TS_DESC").substring(0, 256); //truncate overlong descriptions
const homepage = Deno.env.get("TS_WEBSITE");
const categories = Deno.env.get("TS_CATEGORIES").replace(/\n/g, ','); //support comma and new-line delimiters
const categories = Deno.env.get("TS_CATEGORIES").replace(/\s/g, ','); //support comma and new-line delimiters
const deps = Deno.env.get("TS_DEPS").replace(/\n/g, ' ');
const community = Deno.env.get("TS_COMMUNITY");
const nsfw = Deno.env.get("TS_NSFW");
const wrap = Deno.env.get("TS_WRAP");
const repo = Deno.env.get("TS_REPO");


//these should be set already but we're rewriting the whole file anyways
Expand All @@ -25,6 +26,8 @@ tstore.publish.communities = [community];
tstore.build.copy[0].target = wrap;
tstore.package.dependencies = {};

tstore.publish.repository = repo ?? "https://thunderstore.io"


//check for optional inputs
if (homepage && homepage !== "") {
Expand Down
4 changes: 3 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ function configure(){
function publish() {
if [ -n "$TS_DEV" ]; then
repo="https://thunderstore.dev"
else
elif [ -n "$TS_REPO" ]; then
repo="https://thunderstore.io"
else
repo="$TS_REPO"
fi

# skip the build if there is a prebuilt package provided
Expand Down

0 comments on commit 567c294

Please sign in to comment.