@ -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<<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
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 }}