diff --git a/.github/workflows/init-bepinex-5.yml b/.github/workflows/init-bepinex-5.yml deleted file mode 100644 index 428aa71..0000000 --- a/.github/workflows/init-bepinex-5.yml +++ /dev/null @@ -1,211 +0,0 @@ -name: "[Init] Bepinex 5" - -on: - workflow_dispatch: - inputs: - language: - description: 'F# | C#' - default: 'F#' - required: false - type: string - framework: - description: 'The framework to assign to the new project.' - default: 'netstandard2.1' - required: false - type: string - commonUnityVersion: - description: 'Unity Reference version.' - default: '2022.3.10' - required: false - type: string - gameSteamFolderName: - description: 'The game name underneath your $(STEAMAPPS) dir.' - default: 'Game' - required: false - type: string - publishNupkg: - description: 'To publish to Nuget/Github or not.' - default: false - required: false - type: boolean - publishTSpkg: - description: 'To publish to Thunderstore or not.' - default: false - required: false - type: boolean - - name: - description: 'The name of the solution and project.' - type: string - -jobs: - setup_files: - name: Setup Core Files - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.GPG_SIGNING_PASSPHRASE }} - git_user_signingkey: true - git_commit_gpgsign: true - - uses: actions/setup-dotnet@v4 - - id: run - run: | - dotnet new solution --name '${{inputs.name}}' - mkdir ${{inputs.name}} - if [ -f "./.github/watermarked-logo.png" ]; then - cp "./.github/watermarked-logo.png" "./${{inputs.name}}/icon.png" - fi - echo "languageExtension=$([[ '${{ inputs.language }}' == 'F#' ]] && echo '.fs' || echo '.cs')" >> $GITHUB_OUTPUT - - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - const path = require('path'); - - const readmePath = path.join(process.cwd(), './README.md'); - const readmeContent = fs.readFileSync(readmePath, 'utf-8'); - let readmeLines = readmeContent.split('\n'); - - readmeLines[0] = "# ${{inputs.name}}"; - readmeLines[1] = "${{github.event.repository.description}}"; - const newReadmeContent = readmeLines.join('\n'); - fs.writeFileSync(readmePath, newReadmeContent); - - console.log("README.md has been updated."); - - - uses: 1arp/create-a-file-action@0.4.5 - with: - path: '${{inputs.name}}/' - file: '${{inputs.name}}${{steps.run.outputs.languageExtension}}proj' - content: | - - - ${{inputs.framework}} - ${{inputs.name}} - true - true - - true - false - - $(STEAMAPPS)${{inputs.gameSteamFolderName}}/${{inputs.gameSteamFolderName}}_Data/Managed/ - ${{inputs.commonUnityVersion}} - - https://thunderstore.dev - ${{vars.TCLI_USERNAME}} - ${{inputs.publishNupkg}} - ${{inputs.publishTSpkg}} - - - - /BepInEx/plugins/$(SolutionName)/ - /BepInEx/core/ - - - - - - - - - - - - - - - - - - - - uses: 1arp/create-a-file-action@0.4.5 - if: ${{steps.run.outputs.languageExtension == '.fs'}} - with: - path: '${{inputs.name}}/' - file: '${{inputs.name}}Plugin.fs' - content: | - namespace ${{inputs.name}} - - open BepInEx - open HarmonyLib - open BepInEx.Logging - open Utils.Operators - - module ${{inputs.name}} = - let mutable internal Plugin: BaseUnityPlugin option = None - let mutable internal Logger: ManualLogSource option = None - let mutable internal Patcher: Harmony option = None - open ${{inputs.name}} - - [] - type ${{inputs.name}}Plugin() = - inherit BaseUnityPlugin() - - member this.Awake() = - Plugin <- Some this - Logger <- Some this.Logger - Patcher <- Harmony(this.Info.Metadata.GUID) |> Some - - -optional { - let! patcher = Patcher - let! logger = Logger - do patcher.PatchAll() - let patchedMethodCount = patcher.GetPatchedMethods() |> Array.ofSeq |> (_.Length) - let patchedMethodSuffix = if patchedMethodCount = 1 then "" else "s" - do - $"{MyPluginInfo.PLUGIN_NAME} v{MyPluginInfo.PLUGIN_VERSION} loaded! Successfully patched {patchedMethodCount} method{patchedMethodSuffix}." - |> logger.LogInfo - return () - } - - - uses: 1arp/create-a-file-action@0.4.5 - if: ${{steps.run.outputs.languageExtension == '.cs'}} - with: - path: '${{inputs.name}}/' - file: '${{inputs.name}}Plugin.cs' - content: | - using BepInEx; - using HarmonyLib; - using BepInEx.Logging; - using System.Linq; - - namespace ${{inputs.name}} { - static class ${{inputs.name}} { - internal static BaseUnityPlugin Plugin; - internal static ManualLogSource Logger; - internal static Harmony Patcher; - } - [BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)] - class ${{inputs.name}}Plugin : BaseUnityPlugin { - void Awake() { - ${{inputs.name}}.Plugin = this; - ${{inputs.name}}.Logger = this.Logger; - ${{inputs.name}}.Patcher = new Harmony(this.Info.Metadata.GUID); - - ${{inputs.name}}.Patcher.PatchAll(); - var patchedMethodCount = ${{inputs.name}}.Patcher.GetPatchedMethods().Count(); - var patchedMethodSuffix = patchedMethodCount == 1 ? "" : "s"; - - ${{inputs.name}}.Logger.LogInfo($"{MyPluginInfo.PLUGIN_NAME} v{MyPluginInfo.PLUGIN_VERSION} loaded! Successfully patched {patchedMethodCount} method{patchedMethodSuffix}."); - } - } - } - - - env: - GH_TOKEN: ${{ github.token }} - pr-branch: added/initial/bepinex5 - run: | - dotnet sln add "./${{inputs.name}}/${{inputs.name}}${{steps.run.outputs.languageExtension}}proj" - git checkout ${{env.pr-branch}} 2>/dev/null || git checkout -b ${{env.pr-branch}} - git add . - git commit -m "Added initial SLN & ${{steps.run.outputs.languageExtension}}proj" - git tag v1.0.0 - git push --set-upstream origin ${{env.pr-branch}} --tags - gh pr create --base ${{ github.event.repository.default_branch }} --head ${{env.pr-branch}} --title "Setup BepInEx5 ${{inputs.language}} Project" --body "" || echo "PR already exists or another error occurred" - gh pr view --json url -t '{{.url}}' >> $GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/.github/workflows/organization-compliance.yml b/.github/workflows/organization-compliance.yml deleted file mode 100644 index c6ab784..0000000 --- a/.github/workflows/organization-compliance.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Settings Sync - -on: - workflow_dispatch: - push: - branches: - - '**' - -jobs: - get-template-repo: - name: Parent Template Repository - runs-on: ubuntu-latest - outputs: - template_repository: ${{ steps.org-grab.outputs.result }} - steps: - - name: Get Organization Data - id: org-grab - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.ORG_PAT }} - script: | - const fs = require('fs'); - var request = await github.rest.repos.get({ - ...context.repo - }); - if (request.status != 200) - throw new Exception('Bad API response: ' + request.status); - - return request.data.template_repository == undefined ? {} : request.data.template_repository; - - run-init: - name: Repository Settings Synchronization - needs: get-template-repo - if: ${{ fromJson(needs.get-template-repo.outputs.template_repository).full_name != '' }} - runs-on: ubuntu-latest - env: - CUR_REPO: ${{ github.repository }} - SOURCE_REPO: ${{ fromJson(needs.get-template-repo.outputs.template_repository).full_name }} - steps: - - name: Copy On Rulesets - uses: DayDreamMods/copy-rulesets-action@2024.6.12 - with: - token: ${{ secrets.ORG_PAT }} - source-repo: ${{ env.SOURCE_REPO }} - regex-filter: '✓+.*' - ruleset-enabled: true - overwrite: true - - name: Copy Off Rulesets - uses: DayDreamMods/copy-rulesets-action@2024.6.12 - with: - token: ${{ secrets.ORG_PAT }} - source-repo: ${{ env.SOURCE_REPO }} - regex-filter: '✗+.*' - ruleset-enabled: false - overwrite: true - - - name: Copy Labels - uses: DayDreamMods/copy-labels-action@2024.6.4 - with: - token: ${{ secrets.ORG_PAT }} - source-repo: ${{ env.SOURCE_REPO }} - - - name: Copy Repo Settings - uses: DayDreamMods/copy-settings-action@2024.6.6 - with: - token: ${{ secrets.ORG_PAT }} - source-repo: ${{ env.SOURCE_REPO }} - - one-time: - name: Execute One Time - runs-on: ubuntu-latest - steps: - - name: Disable Workflow - run: | - gh workflow disable -R $GITHUB_REPOSITORY "${{ github.workflow }}" - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/organization-template-update.yml b/.github/workflows/organization-template-update.yml deleted file mode 100644 index f0fcb90..0000000 --- a/.github/workflows/organization-template-update.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: Organization Template Updates - -on: - push: - branches: - - 'main' - -jobs: - get-repositories: - name: Organization Repositories - if: ${{ github.event.repository.is_template }} - runs-on: ubuntu-latest - outputs: - repositories: ${{ steps.org-grab.outputs.result }} - repositories-length: ${{ steps.org-grab.outputs.repositories-length }} - env: - this_repo: ${{ github.repository }} - steps: - - name: Get Organization Data - id: org-grab - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.ORG_PAT }} - script: | - var request = await github.request(`GET ${context.payload.organization.repos_url.replace('https://api.github.com', '')}`); - if (request.status != 200) - throw new Exception('Bad API response: ' + request.status); - - var repos = (await Promise.all( - request.data.map(async i => await github.rest.repos.get({ - owner: i.owner.login, repo: i.name - })))).map(i => i.data) - .filter(i => !i.archived && !i.private && - i.template_repository != null && i.template_repository.full_name == process.env.this_repo); - core.setOutput('repositories-length', repos.length); - return repos; - - update-matrix: - name: Update ${{ matrix.target-repo.full_name }} - needs: get-repositories - if: ${{ needs.get-repositories.outputs.repositories-length != '0' }} - runs-on: ubuntu-latest - strategy: - matrix: - target-repo: ${{ fromJson(needs.get-repositories.outputs.repositories) }} - env: - PR_BRANCH: updated/template/${{ github.event.repository.name }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.ORG_PAT }} - repository: ${{ matrix.target-repo.full_name }} - ref: ${{ matrix.target-repo.default_branch }} - fetch-depth: 0 - - - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.GPG_SIGNING_PASSPHRASE }} - git_user_signingkey: true - git_commit_gpgsign: true - - - name: Merge Remote - id: merge - env: - REMOTE_FULLNAME: ${{ github.repository }} - REMOTE_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} - run: | - git checkout ${{ env.PR_BRANCH }} 2>/dev/null || git checkout -b ${{ env.PR_BRANCH }} - git remote add ${{ env.REMOTE_FULLNAME }} https://github.com/${{ env.REMOTE_FULLNAME }}.git - git fetch ${{ env.REMOTE_FULLNAME }} ${{ env.REMOTE_DEFAULT_BRANCH}} - git merge -X theirs --allow-unrelated-histories ${{ env.REMOTE_FULLNAME }}/${{ env.REMOTE_DEFAULT_BRANCH}} - - echo 'GIT_DIFF<> $GITHUB_OUTPUT - git diff ${{ env.PR_BRANCH }} ${{ matrix.target-repo.default_branch }} >> $GITHUB_OUTPUT - echo 'EOF' >> $GITHUB_OUTPUT - - - name: Create PR - if: ${{ steps.merge.outputs.GIT_DIFF != ''}} - env: - GH_TOKEN: ${{ secrets.ORG_PAT }} - run: | - git push --set-upstream origin ${{ env.PR_BRANCH }} - gh pr create --base ${{ matrix.target-repo.default_branch }} --head ${{ env.PR_BRANCH }} --title "Update Template '${{ github.event.repository.name }}'" --body "" || echo "PR already exists or another error occurred" - gh pr view --json url -t '{{.url}}' >> $GITHUB_STEP_SUMMARY diff --git a/dotnet-common b/dotnet-common index 0386580..415ed5e 160000 --- a/dotnet-common +++ b/dotnet-common @@ -1 +1 @@ -Subproject commit 038658061d90395fb8359169f2a0360714bb5ef2 +Subproject commit 415ed5eb6352eb177113a2adee931c25a89da3c8