Skip to content
Merged

File #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ jobs:
website: "https://greenboi.me"
categories: "mods maps tools items"
- run: echo ${{ steps.pub.outputs.url }}
- uses: actions/checkout@v3
- id: pub_prebuilt
uses: ./
with:
namespace: GreenTF
description: Test
dev: true
token: ${{ secrets.TS_KEY }}
name: test
version: 0.${{ github.run_number }}.1
community: test # needs to be test for thunderstore.dev
file: test_zip.zip





# publish:
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ RUN ["mv", "-v", "tcli-0.1.4-linux-x64/tcli", "/bin/tcli"]
COPY ./entrypoint.sh /entrypoint.sh
COPY ./cfg_edit.js /cfg_edit.js
RUN ["chmod", "+x", "/entrypoint.sh"]
RUN ["deno", "cache", "/cfg_edit.js"]
ENTRYPOINT ["/entrypoint.sh"]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ Check the wiki [here](https://github.com/GreenTF/upload-thunderstore-package/wik
| `name` | Name of the package. | `true` |
| `description` | Description of the package that will appear on Thunderstore. | `true` |
| `version` | Package version in SemVer format. | `true` |
| `file` | Path to a prebuilt zip file. Will skip the build step if provided. | `false` |
| `path` | Path of the files to package. Useful when using build artifacts from other steps. Defaults to using the contents of the repo. | `false` |
| `icon` | URL to download the icon from. Will try to find `icon.png` in the root of the repo if not provided. | `false` |
| `readme` | URL to download the readme from. Will try to fine `README.md` in the root of the repo if not provided. | `false` |
| `readme` | URL to download the readme from. Will try to find `README.md` in the root of the repo if not provided. | `false` |
| `dev` | Publish to https://thunderstore.dev if set, https://thunderstore.io if not set. | `false` |
| `wrap` | Directory to wrap the contents of the repo in. By default the contents of the root of the repo will be in the root of the package. | `false` |
| `categories` | A list, separated by spaces of categories to give to the mod when published. These must be available in the community you're publishing to. | `false` |
Expand Down
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ inputs:
description: 'List of dependencies by name & version'
nsfw:
description: 'Is the mod NSFW'
file:
description: 'Prebuilt .zip file to use, relative to the repo root'
outputs:
url:
description: 'URL of uploaded mod'
runs:
using: docker
image: Dockerfile
image: ghcr.io/greentf/utp:latest
env:
TCLI_AUTH_TOKEN: ${{ inputs.token }}
TS_COMMUNITY: ${{ inputs.community }}
Expand All @@ -64,3 +66,4 @@ runs:
TS_CATEGORIES: ${{ inputs.categories }}
TS_DEPS: ${{ inputs.deps }}
TS_NSFW: ${{ inputs.nsfw }}
TS_FILE: ${{ inputs.file }}
7 changes: 1 addition & 6 deletions cfg_edit.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import * as TOML from "https://unpkg.com/@aduh95/toml@0.4.2/web/toml2js.js";

//init toml parser for some reason idk there was no Deno native module
await TOML.default();


import * as TOML from "npm:@aduh95/toml@0.4.2";

//Read in thunderstore.toml
const tstore = TOML.parse(await Deno.readTextFile("./thunderstore.toml"));
Expand Down
20 changes: 15 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,26 @@ function publish() {
else
repo="https://thunderstore.io"
fi
echo "::group::Build and publish"
tcli build
echo "Publish to $repo"
out=$(tcli publish --repository ${repo} --file build/*.zip) #capture the output to get the URL

# skip the build if there is a prebuilt package provided
if [ -n "$TS_FILE" ]; then
echo "::group::Publish package"
echo "Publish to $repo"
file="dist/$TS_FILE"
else
echo "::group::Build and publish"
tcli build
echo "Publish to $repo"
file="build/*.zip"
fi

out=$(tcli publish --repository ${repo} --file ${file}) #capture the output to get the URL
# A bad response from the server doesn't exit with a non-zero status code
if [[ $? -ne 0 ]]; then
echo "::error::$(echo ${out} | grep -Eo ERROR:.*)"
exit 1
fi
echo "::set-output name=url::$(echo ${out} | grep -Eo "https.*")"
echo "url=$(echo ${out} | grep -Eo "https.*")" >> $GITHUB_OUTPUT
echo "Done!"
echo "::endgroup::"
}
Expand Down
Binary file added test_zip.zip
Binary file not shown.