Git Product home page Git Product logo

upload-thunderstore-package's Introduction

upload-thunderstore-package

Github action that uses the thunderstore CLI to upload a package to thunderstore

Usage

warning sign
!!!IMPORTANT!!!
DON'T PUT YOUR TOKEN IN THE WORKFLOW FILE. DOING SO WILL ALLOW ANYONE TO UPLOAD ANY MODS UNDER YOUR NAME!

⚠️ Add it to your repo secrets and access it in the workflow with ${{ secrets.YOUR_TOKEN_NAME }} ⚠️

name: Publish Mod

# Run when a new release is... released
on: 
  release:
    types: [published]

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      # Use checkout to publish the files in your repo
      - uses: actions/checkout@v3
      - uses: GreenTF/[email protected]
        with:
          namespace: GreenTF # the thunderstore 'team' to publish under
          description: Test 
          token: ${{ secrets.YOUR_TOKEN_NAME }}
          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

Getting a Thunderstore token

Check the wiki here

Finding the available categories

Figuring out how to refer to your community's categories can be somewhat confusing.

To find the categories available to your community, check out https://thunderstore.io/api/experimental/community/YOUR_COMMUNITY/category/, which will return a list of categories in a JSON format. Each category will have a name value and a slug value. The slug is the value you need to put in the categories list of the action.

Example

curl -X GET "https://thunderstore.io/api/experimental/community/northstar/category/" -H  "accept: application/json" | jq # 'jq' is a command line utility that formats JSON
{
  "pagination": {
    "next_link": null,
    "previous_link": null
  },
  "results": [
    {
      "name": "Models",
      "slug": "models"
    },
    {
      "name": "Maps",
      "slug": "maps"
    },
    // a bunch of others...
  ]
}

Inputs

Input Description Required
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). 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
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 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 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 [email protected] 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 true mark the mod as NSFW false

Outputs

Output Description
url The download URL of the published package

upload-thunderstore-package's People

Contributors

anactualemerald avatar digitalroot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

upload-thunderstore-package's Issues

Some help needed

Hello,

I'm trying to get this to work for my stuff. It's failing on the publish phase. Here's my failed job.

My package looks like:

image

And I just want to send the first zip to the Thunderstore.

Categories error

Hey, I have this error when publishing :

Error: ERROR: Unexpected response from the server while publishing package: Status code: 400 BadRequest {"categories":{"2":["Object not found"],"3":["Object not found"],"4":["Object not found"]}} Exiting

And here are my categories in my publish.yml.

          categories: |
            mods
            client-side
            custom-menus
            language-en
            language-cn

Unclear instruction for when category name contains space

The action uses spaces as a delimiter for defining multiple categories to upload a mod under, i.e. from the readme it says

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.

Thing is the Northstar community for example has multiple categories that have spaces in their name:

image

It's not clear how to escape the space in such a case or if it is even possible to upload to such a category using the action ^^

Support for setting website URL and auto-setting website URL to repo URL

The JSON manifest in Thunderstore allows setting a website URL. Usually this is just the URL to the GitHub repo that hosts the code of a certain mod.

{
    "name": "My Awesome Mod",
    "description": "An awesome mod I made",
    "website_url": "https://github.com/example/test", // <--- this one
    "dependencies": [
        "Example-Mod-4.2.0"
    ],
    "version_number": "0.6.9"
}

It would be nice if the action would support setting a website URL. Further if no website URL is provided it should just default to the current repo URL, to require as little configuration from the modder as possible. ^^

Question about `file`

Heya,

I'm planning to use this action to deploy my mod automatically. My CI setup already outputs .zip files ready to be uploaded to Thunderstore, which I wish to upload directly using file.

  • Why is description required if it's specified in the manifest in the .zip?
  • Will it read the icon/readme/categories/deps/website from the artifact I provide automatically? Do I need to provide these twice?

My understanding is that the action has an optional build step to create the .zip file, but I am unsure if it will properly read the existing contents of the zip file (like the Thunderstore website does).

Thanks!

Can't upload a zip

Hello, tried to use your Action to upload a Lethal Company mod
here my workflow
https://github.com/HolographicWings/LethalExpansion/blob/main/.github/workflows/release.yml
here the error
https://github.com/HolographicWings/LethalExpansion/actions/runs/7207501490/job/19634484153

did i failed anything ? i want to upload a premade zip instead of generating another one

EDIT :
i got this error too
https://github.com/HolographicWings/LethalSDK-Unity-Project/actions/runs/7207554043/job/19634627952 with my second package
the community and domains seems to be good (community is lethal-company and domain is default thunderstore.io)
the modpage is https://thunderstore.io/c/lethal-company

Action should strip leading `v` on from tag by default

The convention is to use a leading for version number tags, i.e. git tag v4.2.0 However Thunderstore strictly requires a X.Y.Z version number format, i.e. no leading v.

As such the action should strip the leading v from the tag when generating the version number for Thunderstore.

Alternatively https://github.com/GreenTF/NSModTemplate could be updated to pass a stripped version number to the action instead of github.ref_name ^^

Support mod dependencies

Allow users to specify dependencies for their mods. This will be much simpler after the js rewrite.

Support for community specific categories

After raising an issue with tcli here. It looks to be an entirely different config option that this action doesnt support.

Perhaps an option like 'category_community' which will make

[publish.categories]
category_community=[categories]

instead of

[publish]
categories=[categories]

I havent actually tried tcli publish with the category community yet (i dont have any updates to publish). But i am confident based off of documentation and the issue that it will work.

Publish failed

The publishing failed.

I was in v3 the first time and switch to v3.1 when it failed the first time, but failed again in v3.1.
I post the log and the workflow file under the log.

Current runner version: '[2](https://github.com/AlphaGaming7780/Titanfall-Legends/actions/runs/4159039031/jobs/7194728825#step:1:2).[3](https://github.com/AlphaGaming7780/Titanfall-Legends/actions/runs/4159039031/jobs/7194728825#step:1:3)01.1'
Operating System
Runner Image
Runner Image Provisioner
GITHUB_TOKEN Permissions
Secret source: Actions
##[debug]Primary repository: AlphaGaming[7](https://github.com/AlphaGaming7780/Titanfall-Legends/actions/runs/4159039031/jobs/7194728825#step:1:8)780/Titanfall-Legends
Prepare workflow directory
##[debug]Creating pipeline directory: '/home/runner/work/Titanfall-Legends'
##[debug]Creating workspace directory: '/home/runner/work/Titanfall-Legends/Titanfall-Legends'
##[debug]Update context data
##[debug]Evaluating job-level environment variables
##[debug]Evaluating: github.event.repository.name
##[debug]Evaluating Index:
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating github:
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'event'
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'repository'
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'name'
##[debug]=> 'Titanfall-Legends'
##[debug]Result: 'Titanfall-Legends'
##[debug]Evaluating job container
##[debug]Evaluating job service containers
##[debug]Evaluating job defaults
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v3' (SHA:ac593985615ec2ede58e132d2e21d2b1cbd6[12](https://github.com/AlphaGaming7780/Titanfall-Legends/actions/runs/4159039031/jobs/7194728825#step:1:14)7c)
##[debug]Download 'https://api.github.com/repos/actions/checkout/tarball/ac593985615ec2ede58e132d2e21d2b1cbd6127c' to '/home/runner/work/_actions/_temp_c0ea8ef7-fe6b-4371-a2ed-59a95a51b3af/adf87bcd-4d3e-4d82-a[20](https://github.com/AlphaGaming7780/Titanfall-Legends/actions/runs/4159039031/jobs/7194728825#step:1:24)2-736862039b1c.tar.gz'
##[debug]Unwrap 'actions-checkout-ac59398' to '/home/runner/work/_actions/actions/checkout/v3'
##[debug]Archive '/home/runner/work/_actions/_temp_c0ea8ef7-fe6b-4371-a2ed-59a95a51b3af/adf87bcd-4d3e-4d82-a202-736862039b1c.tar.gz' has been unzipped into '/home/runner/work/_actions/actions/checkout/v3'.
Download action repository 'GreenTF/upload-thunderstore-package@v3' (SHA:7688a3c957df0830f42a172e8f388778a49539b1)
##[debug]Download 'https://api.github.com/repos/GreenTF/upload-thunderstore-package/tarball/7688a3c957df0830f42a172e8f388778a49539b1' to '/home/runner/work/_actions/_temp_7e9c290a-3f28-45[23](https://github.com/AlphaGaming7780/Titanfall-Legends/actions/runs/4159039031/jobs/7194728825#step:1:27)-afbd-20b92bbeac6e/3178db3b-d804-497d-9932-f6be6d923891.tar.gz'
##[debug]Unwrap 'GreenTF-upload-thunderstore-package-7688a3c' to '/home/runner/work/_actions/GreenTF/upload-thunderstore-package/v3'
##[debug]Archive '/home/runner/work/_actions/_temp_7e9c290a-3f[28](https://github.com/AlphaGaming7780/Titanfall-Legends/actions/runs/4159039031/jobs/7194728825#step:1:32)-4523-afbd-20b92bbeac6e/[31](https://github.com/AlphaGaming7780/Titanfall-Legends/actions/runs/4159039031/jobs/7194728825#step:1:35)78db3b-d804-497d-99[32](https://github.com/AlphaGaming7780/Titanfall-Legends/actions/runs/4159039031/jobs/7194728825#step:1:36)-f6be6d92[38](https://github.com/AlphaGaming7780/Titanfall-Legends/actions/runs/4159039031/jobs/7194728825#step:1:42)91.tar.gz' has been unzipped into '/home/runner/work/_actions/GreenTF/upload-thunderstore-package/v3'.
##[debug]action.yml for action: '/home/runner/work/_actions/actions/checkout/v3/action.yml'.
##[debug]action.yml for action: '/home/runner/work/_actions/GreenTF/upload-thunderstore-package/v3/action.yml'.
Error: 'ghcr.io/greentf/utp:latest' should be either '[path]/Dockerfile' or 'docker://image[:tag]'.
##[debug]System.NotSupportedException: 'ghcr.io/greentf/utp:latest' should be either '[path]/Dockerfile' or 'docker://image[:tag]'.
##[debug]   at GitHub.Runner.Worker.ActionManager.PrepareRepositoryActionAsync(IExecutionContext executionContext, ActionStep repositoryAction)
##[debug]   at GitHub.Runner.Worker.ActionManager.PrepareActionsRecursiveAsync(IExecutionContext executionContext, PrepareActionsState state, IEnumerable`1 actions, Int32 depth, Guid parentStepId)
##[debug]   at GitHub.Runner.Worker.ActionManager.PrepareActionsAsync(IExecutionContext executionContext, IEnumerable`1 steps, Guid rootStepId)
##[debug]   at GitHub.Runner.Worker.JobExtension.InitializeJob(IExecutionContext jobContext, AgentJobRequestMessage message)
##[debug]Finishing: Set up job

Workflow :

name: Publish package

on:
  release:
    types: [published] # run when a new release is published
    
env:
  name: ${{github.event.repository.name}} # Edit this if the package name differs from the repo name

jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Get clean version
        run: |
          echo cleanVersion=$(echo ${{github.ref_name}} | sed s/v//g) >> $GITHUB_ENV
      - name: Check that version matches
        run: |
          if [[ "$(grep -Po "\d+\.\d+\.\d+" $(find ./ -name mod.json))" != "${{ env.cleanVersion }}" ]]; then
            echo "::debug::${{env.cleanVersion}}"
            echo "::debug::$(cat $(find ./ -name mod.json ))"
            echo "::error::Version in mod.json does not match tag version"
            exit 1
          fi
  publish:
    runs-on: ubuntu-latest
    needs: verify
    steps:
      - uses: actions/checkout@v3
      - name: Upload Thunderstore Package
        uses: GreenTF/[email protected]
        with:
          community: northstar
          # Name of the team to publish the mod under
          # This should be modified if your github username is different than your team name on Thunderstore
          namespace: Titanfall_Legends # <------ DOUBLE CHECK THIS
          # Name of the package
          name: ${{ env.name }} # This can be modified if the package name differs from the repo name
          # Package version to publish
          version: ${{ github.ref_name }} # This is the tag that was created in the release
          # Description of the mod
          description: Add a Battle Royale gamemode to Titanfall 2. # <----------- UPDATE THIS
          # Thunderstore API token
          token: ${{ secrets.TS_KEY }} 
          # Directory to wrap the contents of the repo in
          wrap: mods/${{ github.repository_owner }}.${{ env.name }} # This will wrap your Author.ModName folder in a mods/ folder before publishing
          #deps: "[email protected]" # <------------- Uncomment this line to add dependencies to your mod, each sparated by a space
          categories: "Mods, Client-side, Server-side"  # <----------------------------- Add more categories as needed, separated by spaces```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.