New stuff #1
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
name: Publish FFTool | ||
on: | ||
push: | ||
tags: | ||
- * | ||
env: | ||
PROJECT_PROPERTIES: TheDialgaTeam.Pokemon3D.Server.prop | ||
PROJECT_PUBLISH_ROOT: bin | ||
DOTNET_VERSION: 7.0.x | ||
RELEASE_TEMPLATE: RELEASE_TEMPLATE.md | ||
defaults: | ||
run: | ||
shell: pwsh | ||
jobs: | ||
build: | ||
name: Build and Publish | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Install dotnet | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
- name: Setup NuGet Credentials | ||
run: | | ||
dotnet nuget add source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --name "github/${{ github.repository_owner }}" --username "${{ github.actor }}" --password "${{ github.token }}" --store-password-in-clear-text | ||
- name: Get version number | ||
id: get_version | ||
run: | | ||
$version = "${{ github.ref }}" -split "/" | Select-Object -Last 1 | ||
Write-Output "::set-output name=version::$version" | ||
- name: Patch project properties | ||
run: | | ||
$version = "${{ steps.get_version.outputs.version }}" | ||
$properties_file = Join-Path "${{ github.workspace }}" "${{ env.PROJECT_PROPERTIES }}" | ||
((Get-Content "$properties_file") -replace '^(\s*)<Version>.+?<\/Version>(\s*)$', "`$1<Version>${version}</Version>`$2") | Set-Content "${properties_file}" | ||
- name: Build project | ||
run: | | ||
dotnet publish -c Release -r win-x64 | ||
dotnet publish -c Release -r linux-x64 | ||
dotnet publish -c Release -r osx-x64 | ||
- name: Compress Files | ||
run: | | ||
cd bin | ||
7z a -mx9 "win-x64.zip" "win-x64" | ||
7z a "linux-x64.tar" "linux-x64" | ||
7z a -mx9 -sdel "linux-x64.tar.gz" "linux-x64.tar" | ||
7z a "osx-x64.tar" "osx-x64" | ||
7z a -mx9 -sdel "osx-x64.tar.gz" "osx-x64.tar" | ||
- name: Deploy | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: Pokemon 3D Server ${{ steps.get_version.outputs.version }} | ||
body_path: ${{ github.workspace }}/${{ env.RELEASE_TEMPLATE }} | ||
files: | | ||
${{ github.workspace }}/${{ env.PROJECT_PUBLISH_ROOT }}/*.zip | ||
${{ github.workspace }}/${{ env.PROJECT_PUBLISH_ROOT }}/*.tar.gz | ||
draft: false | ||
fail_on_unmatched_files: true |