diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 0000000..71f51f7 --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,43 @@ +name: CI/CD +on: [push, pull_request, workflow_dispatch] +jobs: + job: + permissions: write-all + name: CI/CD + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.0.x' + - name: Cache NuGet packages + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: nuget-${{ hashFiles('**/*.csproj') }} + - name: Get project name + id: project + run: echo "name=$(basename -s .csproj *.csproj)" >> $GITHUB_OUTPUT + - name: Build + run: dotnet build -warnaserror -o mod + - name: Get version + if: github.event_name == 'workflow_dispatch' + id: version + uses: kzrnm/get-net-sdk-project-versions-action@v2 + with: + proj-path: ${{ steps.project.outputs.name }}.csproj + - name: Pack release + if: github.event_name == 'workflow_dispatch' + run: | + cd mod + zip -r ../${{ steps.project.outputs.name }}.polymod . + - name: Deploy release + if: github.event_name == 'workflow_dispatch' + run: | + if [[ "${{ steps.version.outputs.version }}" == *"-"* ]]; then + gh release create v${{ steps.version.outputs.version }} ${{ steps.project.outputs.name }}.polymod -p -t v${{ steps.version.outputs.version }} + else + gh release create v${{ steps.version.outputs.version }} ${{ steps.project.outputs.name }}.polymod -t v${{ steps.version.outputs.version }} + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 4507fc7..21a6253 100644 --- a/.gitignore +++ b/.gitignore @@ -399,4 +399,7 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml -# End of https://www.toptal.com/developers/gitignore/api/csharp \ No newline at end of file +# End of https://www.toptal.com/developers/gitignore/api/csharpmodFiles/PolyScriptTemplate.dll +*.polymod + +*.dll diff --git a/Main.cs b/Main.cs index 5e6180f..6c8b259 100644 --- a/Main.cs +++ b/Main.cs @@ -1,10 +1,10 @@ -using BepInEx.Logging; +using PolyMod.Api; namespace PolyScriptTemplate; -public static class Main +public class Main : PolyScript { - public static void Load(ManualLogSource logger) + public override void Load() { - logger.LogMessage("Here we go!"); + Logger.LogMessage("Here we go"); } } diff --git a/PolyScriptTemplate.csproj b/PolyScriptTemplate.csproj index c8c211d..2755518 100644 --- a/PolyScriptTemplate.csproj +++ b/PolyScriptTemplate.csproj @@ -12,6 +12,13 @@ - + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + diff --git a/mod/manifest.json b/mod/manifest.json new file mode 100644 index 0000000..c77f03f --- /dev/null +++ b/mod/manifest.json @@ -0,0 +1,5 @@ +{ + "id": "template", + "version": "1.0.0", + "authors": ["your_name_here"] +}