Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
GeckoEidechse committed Aug 14, 2024
0 parents commit 2790ae4
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish package

on:
push:
tags:
- "*"

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/upload-thunderstore-package@v3.1
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: ${{ github.repository_owner }} # <------ 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: Example mod description # <----------- 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: "northstar-Northstar@1.9.3" # <------------- Uncomment this line to add dependencies to your mod, each sparated by a space
categories: "mods" # <----------------------------- Add more categories as needed, separated by spaces
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Emerald

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# NSModTemplate
A template repository for Northstar mods with a ~~mostly~~ pre-configured github action for publishing to Thunderstore

## Usage
<ol>
<li> Click the <code>Use this template</code> button on the top right of the repo's landing page (<a href="https://github.com/GreenTF/NSModTemplate">here</a>)</li>
<li> Give the new repo a name and make sure it's set to <code>public</code></li>
<li> <details><summary> In the <code>settings</code> tab, under <code>actions</code> -> <code>general</code>, set <code>Actions permissions</code> to <code>Allow all actions and reusable workflows</code></summary>
<img src="https://user-images.githubusercontent.com/4367791/180306016-04bfc321-b60f-4ed0-ac0c-5a6065036e2c.png" />
</details></li>
<li> <details><summary> Also in <code>settings</code>, under <code>secrets</code> -> <code>actions</code>, add your Thunderstore token as a secret named <code>TS_KEY</code> (Steps for getting a token can be found <a href="https://github.com/GreenTF/upload-thunderstore-package/wiki">here</a>)</summary>
<img src="https://user-images.githubusercontent.com/4367791/180306285-60dd51ec-0448-44af-aa92-682599c6c0f4.png" />
<img src="https://user-images.githubusercontent.com/4367791/180306391-a217f309-e875-4e74-8270-8155c60dbcdc.png" />
</details>
</li>
<li> <details><summary>Edit <code>.github/workflows/publish.yml</code> ~line 43 to add a description for your mod </summary>
<img src="https://user-images.githubusercontent.com/4367791/180337843-5213db45-850b-4759-98c5-9ad47cbab7ba.png" />
</details>
</li>

<li> Update this README and <code>icon.png</code> as they will be used by Thunderstore as well </li>
<li> Write your mod! (HINT: Find the docs <a href="https://r2northstar.readthedocs.io/en/latest/guides/gettingstarted.html">here</a>) </li>
<li> <details><summary>Publish your mod!</summary>
Once you've pushed all your chages to your repo, you'll need to create a tag to trigger the action that will publish your mod to Thunderstore.
Find the `Releases` pane in the sidebar to the right ---->
<br />
<img src="https://github.com/GreenTF/NSModTemplate/assets/4367791/cd789d16-dd0a-4310-8dc1-c1781b6c66a8" />
<br />
Create a new release, filling in the details however you want. The most important part is that the tag matches the version number of your mod. In this example, the <code>Version</code> field in your <code>mod.json</code> should be <code>1.0.0</code>:
<br />
<img src="https://github.com/GreenTF/NSModTemplate/assets/4367791/e3fd6bad-4d1c-438c-b3a3-b683c1316ab5" />
<br />
Once you've added a title and optional description, go ahead and publish that release.
<br />
<img src="https://github.com/GreenTF/NSModTemplate/assets/4367791/9da50c60-87f1-40aa-b5a9-9c69becd4026" />
<br />
If all goes well, you should see a new publish job running in the <code>Actions</code> tab :D
</details>
</li>
</ol>


Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"Name": "Example.Mod",
"Description": "A cool mod that does cool stuff",
"Version": "1.0.0",
"DownloadLink": "https://northstar.thunderstore.io/package/download/Example/Mod/",

"LoadPriority": 0,
"ConVars": [],
"Scripts": [{
"Path": "example.nut",
"RunOn": "(CLIENT || SERVER) && MP",
"ClientCallback": {
"Before":"example_callback"
}
}],
"Localisation": []
}
3 changes: 3 additions & 0 deletions mod/scripts/vscripts/example.nut
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
void function example_callback() {
print( "HEY YOU SHOULD CHANGE THIS" )
}

0 comments on commit 2790ae4

Please sign in to comment.