mirror of https://github.com/BUTR/workflows.git
Create release-nexusmods.yml
parent
7585e539d3
commit
4600ae541a
@ -0,0 +1,105 @@
|
|||||||
|
name: Release Module on NexusMods
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
nexusmods_game_id:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
nexusmods_mod_id:
|
||||||
|
required: true
|
||||||
|
type: number
|
||||||
|
default: -1
|
||||||
|
mod_filename:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
mod_version:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
mod_description:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
artifact_name:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
secrets:
|
||||||
|
NEXUSMODS_APIKEY:
|
||||||
|
required: true
|
||||||
|
NEXUSMODS_COOKIES:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-on-nexusmods:
|
||||||
|
name: Publish Module on NexusMods
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment:
|
||||||
|
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.0
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Download Module artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.artifact_name }}
|
||||||
|
path: ./artifact
|
||||||
|
|
||||||
|
- name: 7z Module
|
||||||
|
run: 7z a -t7z ${{ inputs.mod_filename }}.7z ./artifact/* -mx9
|
||||||
|
#shell: pwsh
|
||||||
|
# pwsh casues it to include the root folder
|
||||||
|
|
||||||
|
- 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 Description
|
||||||
|
id: set_description
|
||||||
|
run: |
|
||||||
|
if ${{ inputs.mod_description == '' }}
|
||||||
|
then
|
||||||
|
desc="$(bannerlord_changelog_parser fulldescription -f "$PWD/changelog.txt")"
|
||||||
|
desc="${desc//'%'/'%25'}"
|
||||||
|
desc="${desc//$'\n'/'%0A'}"
|
||||||
|
desc="${desc//$'\r'/'%0D'}"
|
||||||
|
echo "::set-output name=mod_description::$desc"
|
||||||
|
else
|
||||||
|
desc="${{ inputs.mod_description }}"
|
||||||
|
desc="${desc//'%'/'%25'}"
|
||||||
|
desc="${desc//$'\n'/'%0A'}"
|
||||||
|
desc="${desc//$'\r'/'%0D'}"
|
||||||
|
echo "::set-output name=mod_description::$desc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Install NexusUploader
|
||||||
|
run: dotnet tool install -g NexusUploader;
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
unex upload ${{ inputs.nexusmods_mod_id }} "${{ inputs.mod_filename }}.7z" -v "v${{ steps.set_version.outputs.mod_version }}";
|
||||||
|
env:
|
||||||
|
UNEX_GAME: ${{ inputs.nexusmods_game_id }}
|
||||||
|
UNEX_MODID: ${{ inputs.nexusmods_mod_id }}
|
||||||
|
UNEX_FILENAME: ${{ inputs.mod_filename }}
|
||||||
|
UNEX_FILEDESCRIPTION: ${{ steps.set_description.outputs.mod_description }}
|
||||||
|
UNEX_APIKEY: ${{ secrets.NEXUSMODS_APIKEY }}
|
||||||
|
UNEX_COOKIES: ${{ secrets.NEXUSMODS_COOKIES }}
|
||||||
|
shell: pwsh
|
||||||
Loading…
Reference in New Issue