From 0eb479db99a8483a3d9ba9cfa4d5e8b6b8c78582 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Fri, 20 Mar 2026 11:02:24 +0200 Subject: [PATCH] Replace BUTR.NexusUploader upload with official Nexus-Mods/upload-action - Switch file upload from BUTR.NexusUploader to Nexus-Mods/upload-action@v1.0.0-beta.2 - Add nexusmods_file_group_id input for the new upload action - Keep BUTR.NexusUploader for changelog updates (not supported by new action) - Remove NEXUSMODS_SESSION_COOKIE secret (no longer needed) - Remove append_v_to_version input - Modernize output syntax from ::set-output to $GITHUB_OUTPUT Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/release-nexusmods.yml | 162 ++++++++++++------------ 1 file changed, 78 insertions(+), 84 deletions(-) diff --git a/.github/workflows/release-nexusmods.yml b/.github/workflows/release-nexusmods.yml index 8e256f7..a241d73 100644 --- a/.github/workflows/release-nexusmods.yml +++ b/.github/workflows/release-nexusmods.yml @@ -9,17 +9,20 @@ on: nexusmods_mod_id: required: true type: string + nexusmods_file_group_id: + required: true + type: string mod_filename: required: true type: string mod_version: required: false type: string - default: '' + default: "" mod_description: required: false type: string - default: '' + default: "" artifact_name: required: true type: string @@ -27,15 +30,9 @@ on: required: false type: boolean default: true - append_v_to_version: - required: false - type: boolean - default: true secrets: NEXUSMODS_APIKEY: required: true - NEXUSMODS_SESSION_COOKIE: - required: true jobs: publish-on-nexusmods: @@ -45,87 +42,84 @@ jobs: name: NexusMods url: https://www.nexusmods.com/${{ inputs.nexusmods_game_id }}/mods/${{ inputs.nexusmods_mod_id }} steps: - - - name: Setup - uses: butr/actions-common-setup@v2 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Setup + uses: butr/actions-common-setup@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install BUTR.NexusUploader + run: dotnet tool install -g BUTR.NexusUploader; + shell: pwsh - - name: Download Module artifact - uses: actions/download-artifact@v4 - with: - name: ${{ inputs.artifact_name }} - path: ./artifact - continue-on-error: true + - name: Download Module artifact + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact_name }} + path: ./artifact + continue-on-error: true - - name: Download Module artifact Pattern - uses: actions/download-artifact@v4 - with: - pattern: ${{ inputs.artifact_name }}-* - merge-multiple: true - path: ./artifact - continue-on-error: true + - name: Download Module artifact Pattern + uses: actions/download-artifact@v4 + with: + pattern: ${{ inputs.artifact_name }}-* + merge-multiple: true + path: ./artifact + continue-on-error: true - - name: 7z Module - run: 7z a -t7z "${{ inputs.mod_filename }}.7z" ./artifact/* -mx9 - #shell: pwsh - # pwsh casues it to include the root folder + - name: 7z Module + run: 7z a -t7z "${{ inputs.mod_filename }}.7z" ./artifact/* -mx9 - - name: Install Bannerlord.ChangelogParser - if: ${{ inputs.mod_description == '' }} - run: dotnet tool install -g Bannerlord.ChangelogParser; - shell: pwsh + - name: Install Bannerlord.ChangelogParser + if: ${{ inputs.mod_description == '' }} + run: dotnet tool install -g Bannerlord.ChangelogParser; + shell: pwsh - - name: Set Version - id: set_version - run: | - if ${{ inputs.mod_version == '' }} - then - vers="$(bannerlord_changelog_parser latestversion -f "$PWD/changelog.txt")" - echo "::set-output name=mod_version::$vers" - else - echo "::set-output name=mod_version::${{ inputs.mod_version }}" - fi + - name: Set Version + id: set_version + run: | + if ${{ inputs.mod_version == '' }} + then + vers="$(bannerlord_changelog_parser latestversion -f "$PWD/changelog.txt")" + echo "mod_version=$vers" >> "$GITHUB_OUTPUT" + else + echo "mod_version=${{ inputs.mod_version }}" >> "$GITHUB_OUTPUT" + fi - - name: Set Description - id: set_description - run: | - if ${{ inputs.mod_description == '' }} - then - desc="$(bannerlord_changelog_parser ${{ inputs.mod_description_full && 'fulldescription' || 'description' }} -f "$PWD/changelog.txt")" - desc="${desc//'%'/'%25'}" - desc="${desc//$'"'/'%22'}" - desc="${desc//$'\n'/'%0A'}" - desc="${desc//$'\r'/'%0D'}" - echo "::set-output name=mod_description::$desc" - c_desc="${desc#'For'*'%0A* '}" - c_desc="${c_desc//'%0A* '/'%0A'}" - echo "::set-output name=mod_changelog::$c_desc" - else - desc="${{ inputs.mod_description }}" - desc="${desc//'%'/'%25'}" - desc="${desc//$'"'/'%22'}" - desc="${desc//$'\n'/'%0A'}" - desc="${desc//$'\r'/'%0D'}" - echo "::set-output name=mod_description::$desc" - c_desc="${desc#'For'*'%0A* '}" - c_desc="${c_desc//'%0A* '/'%0A'}" - echo "::set-output name=mod_changelog::$c_desc" - fi + - name: Set Description + id: set_description + run: | + if ${{ inputs.mod_description == '' }} + then + desc="$(bannerlord_changelog_parser ${{ inputs.mod_description_full && 'fulldescription' || 'description' }} -f "$PWD/changelog.txt")" + else + desc="${{ inputs.mod_description }}" + fi + echo "mod_description<> "$GITHUB_OUTPUT" + echo "$desc" >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" + c_desc="${desc#'For'*$'\n'* }" + c_desc="${c_desc//$'\n'* /$'\n'}" + echo "mod_changelog<> "$GITHUB_OUTPUT" + echo "$c_desc" >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" - - name: Install BUTR.NexusUploader - run: dotnet tool install -g BUTR.NexusUploader; - shell: pwsh + - name: Upload to NexusMods + uses: Nexus-Mods/upload-action@v1.0.0-beta.2 + with: + api_key: ${{ secrets.NEXUSMODS_APIKEY }} + file_group_id: ${{ inputs.nexusmods_file_group_id }} + filename: ${{ inputs.mod_filename }}.7z + version: ${{ steps.set_version.outputs.mod_version }} + display_name: ${{ inputs.mod_filename }} + description: ${{ steps.set_description.outputs.mod_description }} + file_category: main - - name: Run BUTR.NexusUploader - run: | - unex upload ${{ inputs.nexusmods_mod_id }} "${{ inputs.mod_filename }}.7z" -v "${{ inputs.append_v_to_version && 'v' || '' }}${{ steps.set_version.outputs.mod_version }}" -f "${{ inputs.mod_filename }}"; - unex changelog "${{ inputs.append_v_to_version && 'v' || '' }}${{ steps.set_version.outputs.mod_version }}" -c "${{ steps.set_description.outputs.mod_changelog }}" -m "${{ inputs.nexusmods_mod_id }}"; - shell: pwsh - env: - UNEX_GAME: ${{ inputs.nexusmods_game_id }} - UNEX_FILEDESCRIPTION: ${{ steps.set_description.outputs.mod_description }} - UNEX_PREVIOUSFILE: auto - UNEX_APIKEY: ${{ secrets.NEXUSMODS_APIKEY }} - UNEX_SESSION_COOKIE: ${{ secrets.NEXUSMODS_SESSION_COOKIE }} - UNEX_DEBUG: true + - name: Update NexusMods Changelog + run: >- + unex changelog "${{ steps.set_version.outputs.mod_version }}" + -c "${{ steps.set_description.outputs.mod_changelog }}" + -m "${{ inputs.nexusmods_mod_id }}"; + shell: pwsh + env: + UNEX_GAME: ${{ inputs.nexusmods_game_id }} + UNEX_APIKEY: ${{ secrets.NEXUSMODS_APIKEY }}