diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d420d5d..bb2ca2b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Action Image CI +name: Build TCLI Image on: workflow_dispatch: @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the Docker image - run: docker build . --file Dockerfile --tag ghcr.io/greentf/utp:latest + run: docker build . --file Dockerfile.tcli --tag ghcr.io/greentf/tcli:latest - name: Authenticate with GHCR if: ${{ github.event_name == 'release' || github.event.inputs.push == 'true' }} uses: docker/login-action@v2.1.0 @@ -29,4 +29,4 @@ jobs: password: ${{ secrets.GHCR_TOKEN }} - name: Push container if: ${{ github.event_name == 'release' || github.event.inputs.push == 'true' }} - run: docker push ghcr.io/greentf/utp:latest + run: docker push ghcr.io/greentf/tcli:latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1d43a4..37b1b8b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - dev pull_request: branches: - main @@ -22,15 +23,25 @@ jobs: uses: ./ with: namespace: GreenTF - description: Test + name: Test dev: true token: ${{ secrets.TS_KEY }} - name: test - version: 0.${{ github.run_number }}.0 + description: | + The FitnessGram Pacer test is a multistage aerobic capacity test that progressively gets more difficult as it continues. + The 20 meter Pacer test will begin in 30 seconds. + Line up at the start. The running speed starts slowly, but gets faster each minute after you hear this signal *boop*. + A single lap should be completed each time you hear this sound *ding*. Remember to run in a straight line, and run as long as possible. + The second time you fail to complete a lap before the sound, your test is over. The test will begin on the word start. + On your mark, get ready, start. + version: v0.${{ github.run_number }}.0 community: test # needs to be test for thunderstore.dev wrap: mods website: "https://greenboi.me" - categories: "mods maps tools items" + categories: | + mods + maps + tools + items - run: echo ${{ steps.pub.outputs.url }} diff --git a/Dockerfile b/Dockerfile index 92d23e1..dc10b28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,11 @@ -FROM denoland/deno as setup -WORKDIR / -RUN ["apt", "update", "-yy"] -RUN ["apt", "install", "wget", "-yy"] -RUN ["wget", "-O", "tcli.tar.gz", "https://github.com/thunderstore-io/thunderstore-cli/releases/download/0.2.1/tcli-0.2.1-linux-x64.tar.gz"] -RUN ["tar", "xvf", "tcli.tar.gz"] -RUN ["mv", "-v", "tcli-0.2.1-linux-x64/tcli", "/bin/tcli"] +FROM denoland/deno as cache +ENV DENO_DIR=/var/tmp/deno_cache +COPY ./cfg_edit.js /cfg_edit.js +RUN deno cache /cfg_edit.js +FROM ghcr.io/greentf/tcli +ENV DENO_DIR=/var/tmp/deno_cache +COPY --from=cache ${DENO_DIR} ${DENO_DIR} 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"] diff --git a/Dockerfile.tcli b/Dockerfile.tcli new file mode 100644 index 0000000..2a80abf --- /dev/null +++ b/Dockerfile.tcli @@ -0,0 +1,6 @@ +FROM denoland/deno +RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/* +RUN ["wget", "-O", "tcli.tar.gz", "https://github.com/thunderstore-io/thunderstore-cli/releases/download/0.2.1/tcli-0.2.1-linux-x64.tar.gz"] +RUN ["tar", "xvf", "tcli.tar.gz"] +RUN ["mv", "-v", "tcli-0.2.1-linux-x64/tcli", "/bin/tcli"] +ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/README.md b/README.md index e3ac201..3e777a0 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ jobs: name: test # the name of the package version: $GITHUB_REF_NAME # Use the tag as the package version community: Northstar + categories: | # <-- notice this pipe character + Foo + Bar: Baz + ``` ## Getting a Thunderstore token @@ -54,10 +58,10 @@ Check the wiki [here](https://github.com/GreenTF/upload-thunderstore-package/wik | `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` | +| `categories` | A list, separated by newline characters, of categories to give to the mod when published. These must be available in the community you're publishing to. | `false` | | `deps` | A list, separated by spaces, of mods this mod depends on. Must be in `namespace-modname@1.2.3` format. The publish will fail if any of these aren't a real package. | `false` | | `website` | The homepage URL for the mod. Defaults to the github repo URL. | `false` -| `nsfw` | Set this to mark the mod as NSFW | `false` | +| `nsfw` | Set this to `true` mark the mod as NSFW | `false` | ## Outputs | Output | Description | diff --git a/action.yml b/action.yml index e8a7543..5da4658 100644 --- a/action.yml +++ b/action.yml @@ -49,7 +49,7 @@ outputs: description: 'URL of uploaded mod' runs: using: docker - image: docker://ghcr.io/greentf/utp:latest + image: 'Dockerfile' env: TCLI_AUTH_TOKEN: ${{ inputs.token }} TS_COMMUNITY: ${{ inputs.community }} diff --git a/cfg_edit.js b/cfg_edit.js index c2f5b37..4c98634 100644 --- a/cfg_edit.js +++ b/cfg_edit.js @@ -6,9 +6,9 @@ const tstore = TOML.parse(await Deno.readTextFile("./thunderstore.toml")); const namespace = Deno.env.get("TS_NAMESPACE"); const name = Deno.env.get("TS_NAME"); const version = Deno.env.get("TS_VERSION").replace(/v/g, ''); -const desc = Deno.env.get("TS_DESC"); +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, ''); +const categories = Deno.env.get("TS_CATEGORIES").replace(/\n/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"); @@ -33,13 +33,15 @@ if (homepage && homepage !== "") { tstore.package.websiteUrl = `${Deno.env.get("GITHUB_SERVER_URL")}/${Deno.env.get("GITHUB_REPOSITORY")}`; } -if (nsfw && nsfw !== "" ) { +if (nsfw && nsfw === "true" ) { tstore.package.containsNsfwContent = true } if (categories && categories !== "") { - //only keep truthy elements from the split - tstore.publish.categories = categories.split(' ').filter(e => e).map(e=> e.toLowerCase()); + console.log(`::debug::Parsing categories: ${categories}`); + tstore.publish.categories = categories.split(',') + .filter(e => e) //only keep truthy elements + .map(e=> e.toLowerCase().trim()); } if (deps && deps !== "") { diff --git a/entrypoint.sh b/entrypoint.sh index b1c4e4d..9a4abd6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,4 @@ #!/bin/bash - function setup() { echo "::group::Set up environment" @@ -46,7 +45,7 @@ function configure(){ #tcli usage based off of https://github.com/R2Northstar/Northstar/blob/d8ad8f12f8bca1e8de96f5d7163f71997d487218/.github/workflows/build.yml#L132-L192 echo "Init tcli config" - tcli init --package-name ${TS_NAME} --package-namespace ${TS_NAMESPACE} --package-version ${TS_VERSION} + tcli init --package-name ${TS_NAME} --package-namespace ${TS_NAMESPACE} --package-version ${TS_VERSION#v} if [ -n "$TS_DEV" ]; then TS_COMMUNITY="test"