Starting tech fix #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to build and publish a Reloaded Mod. | |
# by Sewer56 | |
# Produces: | |
# - does NOT Build to Upload to GameBanana (yet) | |
# - Build to Upload to GitHub | |
# - Build to Upload to NuGet | |
# - Changelog | |
# When pushing a tag | |
# - Upload to GitHub Releases | |
# - Upload to Reloaded NuGet Repository | |
name: Build and Publish Reloaded Mod | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- '*' | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
PUBLISH_PATH_GLOB: ./Publish/ToUpload/**/Generic/* | |
PUBLISH_NUGET_PATH: ./Publish/ToUpload/ | |
NUGET_URL: http://packages.sewer56.moe:5000/v3/index.json | |
RELOADEDIIMODS: . | |
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') }} | |
RELEASE_TAG: ${{ github.ref_name }} | |
jobs: | |
build: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: pwsh | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: Setup .NET Core SDK (5.0/6.0/7.0) | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
5.0.x | |
6.0.x | |
7.0.x | |
- name: Build | |
run: ./PublishAll.ps1 -ChangelogPath "$env:PUBLISH_CHANGELOG_PATH" | |
- name: Upload GitHub Release Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
# Artifact name | |
name: GitHub Release | |
# A file, directory or wildcard pattern that describes what to upload | |
path: | | |
${{ env.PUBLISH_PATH_GLOB }} | |
./mrdx_reloaded.r2pack | |
- name: Upload Latest Prerelease to GitHub Releases | |
uses: softprops/action-gh-release@v1 | |
with: | |
# Overwrite the previous prerelease tag | |
prerelease: true | |
tag_name: prerelease | |
# Path to load note-worthy description of changes in release from | |
body: Latest development version | |
# Newline-delimited list of path globs for asset files to upload | |
files: | | |
${{ env.PUBLISH_PATH_GLOB }} | |
./mrdx_reloaded.r2pack | |
- name: Release if tagged version | |
uses: softprops/action-gh-release@v1 | |
if: github.ref_type == 'tag' | |
with: | |
# Newline-delimited list of path globs for asset files to upload | |
files: | | |
${{ env.PUBLISH_PATH_GLOB }} | |
./mrdx_reloaded.r2pack | |
- name: Push to NuGet (on Tag) | |
env: | |
NUGET_KEY: ${{ secrets.RELOADED_NUGET_KEY }} | |
if: env.IS_RELEASE == 'true' | |
run: | | |
if ([string]::IsNullOrEmpty("$env:NUGET_KEY")) | |
{ | |
Write-Host "NuGet Repository Key (GitHub Secrets -> RELOADED_NUGET_KEY) Not Specified. Skipping." | |
return | |
} | |
$items = Get-ChildItem -Recurse "$env:PUBLISH_NUGET_PATH" -Include *.nupkg | |
Foreach ($item in $items) | |
{ | |
Write-Host "Pushing $item" | |
dotnet nuget push "$item" -k "$env:NUGET_KEY" -s "$env:NUGET_URL" --skip-duplicate | |
} |