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) <noreply@anthropic.com>
master
Vitalii Mikhailov 2 days ago
parent c2fab44d5d
commit 0eb479db99

@ -9,17 +9,20 @@ on:
nexusmods_mod_id: nexusmods_mod_id:
required: true required: true
type: string type: string
nexusmods_file_group_id:
required: true
type: string
mod_filename: mod_filename:
required: true required: true
type: string type: string
mod_version: mod_version:
required: false required: false
type: string type: string
default: '' default: ""
mod_description: mod_description:
required: false required: false
type: string type: string
default: '' default: ""
artifact_name: artifact_name:
required: true required: true
type: string type: string
@ -27,15 +30,9 @@ on:
required: false required: false
type: boolean type: boolean
default: true default: true
append_v_to_version:
required: false
type: boolean
default: true
secrets: secrets:
NEXUSMODS_APIKEY: NEXUSMODS_APIKEY:
required: true required: true
NEXUSMODS_SESSION_COOKIE:
required: true
jobs: jobs:
publish-on-nexusmods: publish-on-nexusmods:
@ -45,12 +42,15 @@ jobs:
name: NexusMods name: NexusMods
url: https://www.nexusmods.com/${{ inputs.nexusmods_game_id }}/mods/${{ inputs.nexusmods_mod_id }} url: https://www.nexusmods.com/${{ inputs.nexusmods_game_id }}/mods/${{ inputs.nexusmods_mod_id }}
steps: steps:
- name: Setup - name: Setup
uses: butr/actions-common-setup@v2 uses: butr/actions-common-setup@v2
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install BUTR.NexusUploader
run: dotnet tool install -g BUTR.NexusUploader;
shell: pwsh
- name: Download Module artifact - name: Download Module artifact
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
@ -68,8 +68,6 @@ jobs:
- name: 7z Module - name: 7z Module
run: 7z a -t7z "${{ inputs.mod_filename }}.7z" ./artifact/* -mx9 run: 7z a -t7z "${{ inputs.mod_filename }}.7z" ./artifact/* -mx9
#shell: pwsh
# pwsh casues it to include the root folder
- name: Install Bannerlord.ChangelogParser - name: Install Bannerlord.ChangelogParser
if: ${{ inputs.mod_description == '' }} if: ${{ inputs.mod_description == '' }}
@ -82,9 +80,9 @@ jobs:
if ${{ inputs.mod_version == '' }} if ${{ inputs.mod_version == '' }}
then then
vers="$(bannerlord_changelog_parser latestversion -f "$PWD/changelog.txt")" vers="$(bannerlord_changelog_parser latestversion -f "$PWD/changelog.txt")"
echo "::set-output name=mod_version::$vers" echo "mod_version=$vers" >> "$GITHUB_OUTPUT"
else else
echo "::set-output name=mod_version::${{ inputs.mod_version }}" echo "mod_version=${{ inputs.mod_version }}" >> "$GITHUB_OUTPUT"
fi fi
- name: Set Description - name: Set Description
@ -93,39 +91,35 @@ jobs:
if ${{ inputs.mod_description == '' }} if ${{ inputs.mod_description == '' }}
then then
desc="$(bannerlord_changelog_parser ${{ inputs.mod_description_full && 'fulldescription' || 'description' }} -f "$PWD/changelog.txt")" 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 else
desc="${{ inputs.mod_description }}" 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 fi
echo "mod_description<<EOF" >> "$GITHUB_OUTPUT"
echo "$desc" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
c_desc="${desc#'For'*$'\n'* }"
c_desc="${c_desc//$'\n'* /$'\n'}"
echo "mod_changelog<<EOF" >> "$GITHUB_OUTPUT"
echo "$c_desc" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Install BUTR.NexusUploader - name: Upload to NexusMods
run: dotnet tool install -g BUTR.NexusUploader; uses: Nexus-Mods/upload-action@v1.0.0-beta.2
shell: pwsh 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 - name: Update NexusMods Changelog
run: | 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 "${{ steps.set_version.outputs.mod_version }}"
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 }}"; -c "${{ steps.set_description.outputs.mod_changelog }}"
-m "${{ inputs.nexusmods_mod_id }}";
shell: pwsh shell: pwsh
env: env:
UNEX_GAME: ${{ inputs.nexusmods_game_id }} UNEX_GAME: ${{ inputs.nexusmods_game_id }}
UNEX_FILEDESCRIPTION: ${{ steps.set_description.outputs.mod_description }}
UNEX_PREVIOUSFILE: auto
UNEX_APIKEY: ${{ secrets.NEXUSMODS_APIKEY }} UNEX_APIKEY: ${{ secrets.NEXUSMODS_APIKEY }}
UNEX_SESSION_COOKIE: ${{ secrets.NEXUSMODS_SESSION_COOKIE }}
UNEX_DEBUG: true

Loading…
Cancel
Save