Fixed: I forgot to bump project version in emergency hotfix before sleep #509
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: | |
# - Build to Upload to GameBanana | |
# - Build to Upload to GitHub | |
# - Build to Upload to NuGet | |
# - Changelog | |
# When pushing a tag | |
# - Upload to GitHub Releases | |
# - Upload to Reloaded NuGet Repository (if GitHub Secret RELOADED_NUGET_KEY is specified) | |
name: Build and Publish Reloaded Utils Server | |
on: | |
push: | |
branches: [ master ] | |
tags: | |
- '*' | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
env: | |
PUBLISH_COMMON_PATH: ./source/Mods/Reloaded.Utils.Server/Publish/ToUpload/ | |
PUBLISH_GAMEBANANA_PATH: ./source/Mods/Reloaded.Utils.Server/Publish/ToUpload/GameBanana | |
PUBLISH_GITHUB_PATH: ./source/Mods/Reloaded.Utils.Server/Publish/ToUpload/Generic | |
PUBLISH_NUGET_PATH: ./source/Mods/Reloaded.Utils.Server/Publish/ToUpload/NuGet | |
PUBLISH_CHANGELOG_PATH: ./source/Mods/Reloaded.Utils.Server/Publish/Changelog.md | |
PUBLISH_PATH: ./source/Mods/Reloaded.Utils.Server/Publish | |
# Default value is official Reloaded package server. | |
NUGET_URL: http://packages.sewer56.moe:5000/v3/index.json | |
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@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: Setup .NET Core SDK (5.0) | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 5.0.x | |
- name: Setup .NET Core SDK (8.0) | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '14' | |
- name: Setup AutoChangelog | |
run: npm install -g auto-changelog | |
- name: Create Changelog | |
run: | | |
[System.IO.Directory]::CreateDirectory("$env:PUBLISH_PATH") | |
if ($env:IS_RELEASE -eq 'true') { | |
auto-changelog --sort-commits date --hide-credit --template keepachangelog --commit-limit false --starting-version "$env:RELEASE_TAG" --output "$env:PUBLISH_CHANGELOG_PATH" | |
} | |
else { | |
auto-changelog --sort-commits date --hide-credit --template keepachangelog --commit-limit false --unreleased --output "$env:PUBLISH_CHANGELOG_PATH" | |
} | |
- name: Build | |
run: ./source/Mods/Reloaded.Utils.Server/Publish.ps1 -ChangelogPath "$env:PUBLISH_CHANGELOG_PATH" -BuildR2R true | |
- name: Upload GitHub Release Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
# Artifact name | |
name: GitHub Release | |
# A file, directory or wildcard pattern that describes what to upload | |
path: | | |
${{ env.PUBLISH_GITHUB_PATH }}/* | |
- name: Upload GameBanana Release Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
# Artifact name | |
name: GameBanana Release | |
# A file, directory or wildcard pattern that describes what to upload | |
path: | | |
${{ env.PUBLISH_GAMEBANANA_PATH }}/* | |
- name: Upload NuGet Release Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
# Artifact name | |
name: NuGet Release | |
# A file, directory or wildcard pattern that describes what to upload | |
path: | | |
${{ env.PUBLISH_NUGET_PATH }}/* | |
- name: Upload Changelog Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
# Artifact name | |
name: Changelog | |
# A file, directory or wildcard pattern that describes what to upload | |
path: ${{ env.PUBLISH_CHANGELOG_PATH }} | |
retention-days: 0 | |
- 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 -Path "$env:PUBLISH_NUGET_PATH/*.nupkg" | |
Foreach ($item in $items) | |
{ | |
Write-Host "Pushing $item" | |
dotnet nuget push "$item" -k "$env:NUGET_KEY" -s "$env:NUGET_URL" --skip-duplicate | |
} |