Skip to content

Commit

Permalink
updates: first mod guide
Browse files Browse the repository at this point in the history
  • Loading branch information
RobynLlama committed Jul 30, 2024
1 parent f8ced49 commit 2a37ff3
Showing 1 changed file with 72 additions and 2 deletions.
74 changes: 72 additions & 2 deletions www/Guides/Your-First-Mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ grand_parent: Home

<h3>This page up to date for:</h3>

![Static Badge](https://img.shields.io/badge/Version-56-blue?style=for-the-badge)
{: .warning}
> The template featured on this page is not yet complete. None of the features are expected to work at this time. Feel free to acquaint yourself with the process but do not follow along with commands at this time!
![Static Badge](https://img.shields.io/badge/Version-none-darkred?style=for-the-badge)

# Your First Mod

Expand Down Expand Up @@ -38,6 +41,13 @@ Prerequisites:
- [Create the Remote Workspace](#create-the-remote-workspace)
- [Create the Local Workspace](#create-the-local-workspace)
- [Template Options](#template-options)
- [Building and Running Your First Mod](#building-and-running-your-first-mod)
- [Automated Publishing with a Github Action](#automated-publishing-with-a-github-action)
- [Setting Up Your Publishing Key](#setting-up-your-publishing-key)
- [Running the Publish Action](#running-the-publish-action)
- [Troubleshooting](#troubleshooting)
- [Type or Namespace BepinEx Could Not Be Found](#type-or-namespace-bepinex-could-not-be-found)
- [If The Template Failed to Push Origin](#if-the-template-failed-to-push-origin)

## Initialize Your Plugin Repository

Expand Down Expand Up @@ -97,5 +107,65 @@ Create a new folder with your project name wherever you'd like it to be on your
Example Command:

```bash
dotnet new LCM_TS_Publishing --ProjectGUID com.github.robyn.mycoolmod --ProjectAuthor RobynLlama --ProjectDESC "The coolest mod ever made" --ProjectURL https://github.com/LethalCompanyModding/LCM-Template-TSPublishing
dotnet new LCM_TS_Publishing \
--ProjectGUID com.github.robyn.mycoolmod \
--ProjectAuthor RobynLlama \
--ProjectDESC "The coolest mod ever made" \
--ProjectURL https://github.com/LethalCompanyModding/LCM-Template-TSPublishing
```

If the template fails to push, see the [Troubleshooting](#if-the-template-failed-to-push-origin) section

### Building and Running Your First Mod

Now that the template has been successfully installed and your project has been created, you simply use your IDE's build task or run `dotnet build` in your project's folder. This will create an artifact at `./bin/Debug/YourProjectName.dll` which you may copy to your BepinEx plugins folder.

### Automated Publishing with a Github Action

The template comes pre-loaded with a github action that will allow you to automatically publish a new release to the Thunderstore in response to a version tag.

#### Setting Up Your Publishing Key

{: .note}
> If you already have a service account key or know how to set one up, feel free to skip this step
- Log in to your Thunderstore account that owns the team that will be publishing this mod
- Navigate to the [Thunderstore Teams](https://thunderstore.io/settings/teams/) page and click on the name of the team that will be publishing this mod
- On the left hand side navigation menu choose `Service Accounts` and then `Add Service Account`
- Copy the key somewhere safe for now

{: .warning}
> A service account key should be treated like a password, it can be used to publish to your team and cannot be viewed again once you leave the page. Github also encrypts all secrets so it is not possible to recover it once entered.
- Navigate to the `settings` menu for your repository on github and on the left hand navigation pane select `Secrets and Variables` then `Actions`. In this menu choose `New Repository Secret` and name it **EXACTLY** `TCLI_AUTH_TOKEN` then paste in your service account key as the secret and save it.

#### Running the Publish Action

Once ready, publishing your project is extremely simple.

- First, You need to edit your project's csproj file's `version` field to be a higher number than it was before (For example: If I previously released my project at version 1.0.0 then I would consider 1.0.1 as a valid higher version).
- Second, Create a new tag with the same name as the version you just set. Your IDE may have a specific way to create and push tags (For example: In VSCode press F1 and then type `create tag` and follow the prompts then F1 and `push tags` and choose `origin`). If your IDE does not integrate with git or you just want to do it the old fashioned way then this example will create an annotated 1.0.1 tag with the comment "Release version 1.0.1 and then push it:

```bash
git tag -a 1.0.1 -m "Release version 1.0.1"
git push origin --tags
```

Pushing a new tag like this will trigger the workflow to compile and upload your mod to the Thunderstore.

### Troubleshooting

#### Type or Namespace BepinEx Could Not Be Found

In some cases your IDE may not register the types from Nuget packages immediately. Try running `dotnet restore` in your project's folder and restarting your IDE.

#### If The Template Failed to Push Origin

The template should have run a post-install commit for you in order to properly setup your repository, but in the event that it failed or you were not logged in to your github when activating the template you can run the following code to push your remotes to your repository

{: .note}
> If you have a token in VSCode or VS then use the following command while in the project terminal inside your IDE, otherwise you may need to setup an [SSH key](https://github.com/settings/keys) for pushing to github from the terminal
```bash
git push origin --mirror
```

0 comments on commit 2a37ff3

Please sign in to comment.