-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0fda8df
Showing
17 changed files
with
423 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Use LF as default EOL marker | ||
* text=auto eol=lf | ||
|
||
# Exclude files from 'git archive' | ||
.gitattributes export-ignore | ||
.github export-ignore | ||
.gitignore export-ignore | ||
.gitmodules export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Publish | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: "Tag / Version number (leave empty for dry-run)" | ||
required: false | ||
|
||
env: | ||
changelog: CHANGELOG.md | ||
source-dir: src/ | ||
artifacts-name: hades2-mod-template.zip | ||
artifacts-content-type: application/zip | ||
|
||
jobs: | ||
tag-and-release: | ||
name: Rotate version, tag, and create release | ||
runs-on: ubuntu-latest | ||
if: github.event.inputs.tag | ||
outputs: | ||
upload_url: ${{ steps.release.outputs.upload_url }} | ||
steps: | ||
- name: Check input tag format | ||
run: | | ||
echo "${{ github.event.inputs.tag }}" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | ||
- name: Checkout files | ||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f | ||
|
||
- name: Rotate unreleased section in changelog | ||
uses: thomaseizinger/keep-a-changelog-new-release@77ac767b2f7f6edf2ee72ab3364ed26667086f96 | ||
with: | ||
tag: ${{ github.event.inputs.tag }} | ||
|
||
- name: Push updated files to repository and tag | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git add ${{ env.changelog }} | ||
git commit --message "Release ${{ github.event.inputs.tag }}" | ||
git tag ${{ github.event.inputs.tag }} | ||
git push origin HEAD:${{ github.ref_name }} --tags | ||
- name: Create release | ||
id: release | ||
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e | ||
with: | ||
release_name: ${{ github.event.inputs.tag }} | ||
tag_name: ${{ github.event.inputs.tag }} | ||
commitish: ${{ github.ref_name }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build-and-publish-artifacts: | ||
name: Build and publish artifacts | ||
needs: tag-and-release | ||
if: always() && (needs.tag-and-release.result == 'success' || needs.tag-and-release.result == 'skipped') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout files | ||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f | ||
with: | ||
ref: ${{ github.event.inputs.tag || github.sha }} | ||
lfs: true | ||
|
||
- name: Build artifacts | ||
run: | | ||
cd ${{ env.source-dir }} | ||
zip ../${{ env.artifacts-name }} -r . | ||
- name: Upload artifacts to workflow | ||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 | ||
with: | ||
name: ${{ env.artifacts-name }} | ||
path: ${{ env.artifacts-name }} | ||
retention-days: 1 | ||
|
||
- name: Upload artifacts to release | ||
if: needs.tag-and-release.outputs.upload_url | ||
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 | ||
with: | ||
upload_url: ${{ needs.tag-and-release.outputs.upload_url }} | ||
asset_path: ${{ env.artifacts-name }} | ||
asset_name: ${{ env.artifacts-name }} | ||
asset_content_type: ${{ env.artifacts-content-type }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
|
||
- First version of the template! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 SGG-Modding team | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Hades II mod template | ||
|
||
This mod template can be used as basis for creating your own Hades II mods and | ||
publishing them on [Thunderstore](https://thunderstore.io/). | ||
|
||
## Prerequisites | ||
|
||
- Basic git knowledge. | ||
- Basic Markdown knowledge. | ||
- A GitHub account. | ||
- A Thunderstore team / namespace. | ||
- If you need to create one, login on Thunderstore using your GitHub account. | ||
|
||
## Setup | ||
|
||
- Create a new GitHub repository to host your mod. | ||
- Download [hades2-mod-template.zip](https://github.com/SGG-Modding/Hades2ModTemplate/releases/latest/download/hades2-mod-template.zip) and extract it. | ||
- Edit the following as needed: | ||
- `README.md`: everything about your mod (name, features, etc.). | ||
- `LICENSE`: the [MIT license](https://choosealicense.com/licenses/mit/) is shipped by default. | ||
- If you are OK with that, just edit `[year]` and `[fullname]`. | ||
- If not, make sure to change the license now. | ||
- `thunderstore.toml`: your Thunderstore mod package definition. Edit the following as needed: | ||
- `namespace`: your Thunderstore team / namespace. | ||
- `name`: your mod name. | ||
- `description`: short description of your mod. It will be used by the Thunderstore search, so make sure to include words that people are likely to search for when looking for your mod. | ||
- `websiteUrl`: your GitHub repository (or website, or Discord server, if you prefer). | ||
- `[package.dependencies]`: your mod dependencies. | ||
- `[publish.categories]`: the categories you want your mod to appear under. [See the API](https://thunderstore.io/api/experimental/community/hades-ii/category/) for list of available categories. | ||
- `icon.png`: your Thunderstore mod icon. | ||
- Push everything to your GitHub repository. | ||
- From Thunderstore: | ||
- Go to [**Teams settings**](https://thunderstore.io/settings/teams/) and select your team. | ||
- Create a new **Service Account** for your mod (we recommend using the same name as the mod name). | ||
- You will get an **API token** associated to the new **Service Account**. | ||
- From your GitHub repository: | ||
- Go to **Settings** > **Secrets and variables** > **Actions**. | ||
- Create a **new repository secret** named `TCLI_AUTH_TOKEN` and copy/paste the **API token** as its value. | ||
|
||
That's it, you are now ready to [**develop**](#develop). | ||
|
||
## Develop | ||
|
||
- Make sure to continuously update the `README.md` and `CHANGELOG.md` files as you add, change, or remove features. | ||
- This ensures you won't forget to document them. | ||
- For good practices on changelog maintenance, please see [Keep a Changelog](https://keepachangelog.com/). | ||
- Any git workflow of your choice can be used, however it is recommended that you plan on making releases from your repository's default branch (`main` by default). | ||
|
||
Hack away, and [**release**](#release) when ready. | ||
|
||
## Release | ||
|
||
- From your GitHub repository, go to **Actions** and select the **Publish** workflow on the left. | ||
- Select the **Run workflow** dropdown on the right. | ||
- By default, your repository's default branch (`main` by default) is selected. This is why we recommended for planning on making releases from it. If you want to release from another branch, select it. | ||
- Input the version to release, e.g. `1.2.0`. | ||
- For good practices on versioning, please see [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
- Click the **Run workflow** button. | ||
- A new workflow run will be triggered, and will take care of: | ||
- Rotating `CHANGELOG.md`. | ||
- Tagging the git repository. | ||
- Making a new GitHub release. | ||
- Building the Thunderstore mod package. | ||
- Publishing the package on Thunderstore. | ||
- Uploading the package to the GitHub release as an asset. | ||
- After a new release has been published, it's a good idea to pull the changes locally so as to ensure your local `CHANGELOG.md` is up to date. | ||
|
||
### Dry-run | ||
|
||
- If you leave the version input blank, the workflow will do a dry-run. | ||
- In this mode, a Thunderstore mod package is immediately built of the current state of the chosen branch, and uploaded to the workflow run as an artifact. | ||
- The changelog is not rotated, no tagging happens, no GitHub release is made, no publishing to the Thunderstore. | ||
- This can be used to inspect the Thunderstore package without publishing (e.g. if you are making changes to `thunderstore.toml`). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Use LF as default EOL marker | ||
* text=auto eol=lf | ||
|
||
# Exclude files from 'git archive' | ||
.gitattributes export-ignore | ||
.github export-ignore | ||
.gitignore export-ignore | ||
.gitmodules export-ignore | ||
|
||
# Git LFS | ||
*.png filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: Publish | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: "Tag / Version number (leave empty for dry-run)" | ||
required: false | ||
|
||
env: | ||
changelog: CHANGELOG.md | ||
thunderstore-config: thunderstore.toml | ||
build-dir: build/ | ||
artifacts-content-type: application/zip | ||
|
||
jobs: | ||
tag-and-release: | ||
name: Rotate version, tag, and create release | ||
runs-on: ubuntu-latest | ||
if: github.event.inputs.tag | ||
outputs: | ||
upload_url: ${{ steps.release.outputs.upload_url }} | ||
steps: | ||
- name: Check input tag format | ||
run: | | ||
echo "${{ github.event.inputs.tag }}" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | ||
- name: Checkout files | ||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f | ||
|
||
- name: Rotate unreleased section in changelog | ||
uses: thomaseizinger/keep-a-changelog-new-release@77ac767b2f7f6edf2ee72ab3364ed26667086f96 | ||
with: | ||
tag: ${{ github.event.inputs.tag }} | ||
|
||
- name: Rotate version in Thunderstore CLI config | ||
run: | | ||
sed -i 's/versionNumber = ".*"/versionNumber = "${{ github.event.inputs.tag }}"/' ${{ env.thunderstore-config }} | ||
- name: Push updated files to repository and tag | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git add ${{ env.changelog }} ${{ env.thunderstore-config }} | ||
git commit --message "Release ${{ github.event.inputs.tag }}" | ||
git tag ${{ github.event.inputs.tag }} | ||
git push origin HEAD:${{ github.ref_name }} --tags | ||
- name: Create release | ||
id: release | ||
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e | ||
with: | ||
release_name: ${{ github.event.inputs.tag }} | ||
tag_name: ${{ github.event.inputs.tag }} | ||
commitish: ${{ github.ref_name }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build-and-publish-package: | ||
name: Build and publish package | ||
needs: tag-and-release | ||
if: always() && (needs.tag-and-release.result == 'success' || needs.tag-and-release.result == 'skipped') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout files | ||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f | ||
with: | ||
ref: ${{ github.event.inputs.tag || github.sha }} | ||
lfs: true | ||
|
||
- name: Install Thunderstore CLI | ||
run: dotnet tool install -g tcli | ||
|
||
- name: Build package | ||
if: ${{ !needs.tag-and-release.outputs.upload_url }} | ||
run: tcli build | ||
|
||
- name: Publish package | ||
if: needs.tag-and-release.outputs.upload_url | ||
env: | ||
TCLI_AUTH_TOKEN: ${{ secrets.TCLI_AUTH_TOKEN }} | ||
run: tcli publish | ||
|
||
- name: Retrieve package name | ||
run: | | ||
ARTIFACTS_NAME=$(find "${{ env.build-dir }}" -type f -printf "%f\n") | ||
echo "artifacts-name=${ARTIFACTS_NAME}" >> "$GITHUB_ENV" | ||
- name: Upload artifacts to workflow | ||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 | ||
with: | ||
name: ${{ env.artifacts-name }} | ||
path: ${{ env.build-dir }}/${{ env.artifacts-name }} | ||
retention-days: 1 | ||
|
||
- name: Upload artifacts to release | ||
if: needs.tag-and-release.outputs.upload_url | ||
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 | ||
with: | ||
upload_url: ${{ needs.tag-and-release.outputs.upload_url }} | ||
asset_path: ${{ env.build-dir }}/${{ env.artifacts-name }} | ||
asset_name: ${{ env.artifacts-name }} | ||
asset_content_type: ${{ env.artifacts-content-type }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Thunderstore CLI build output | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
|
||
- First version of the mod! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) [year] [fullname] | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Mod name | ||
|
||
Hades II mod allowing to do some super duper thing. | ||
|
||
## Features | ||
|
||
- Wow. | ||
- Much cool. | ||
- Very doge. | ||
|
||
## Install | ||
|
||
- Do this. | ||
- Do that. | ||
- Nope, not that. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
local mod = ModUtil.Mod.Register("ModName") | ||
|
||
mod.Config = { | ||
Enabled = true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if not ModName.Config.Enabled then return end | ||
|
||
OnAnyLoad { "DeathArea", function(triggerArgs) | ||
DebugPrint({ Text = "Hello World!" }) | ||
end } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Top Import "config.lua" | ||
Import "main.lua" |
Oops, something went wrong.