Skip to content

Ready for realease on tag #2

Ready for realease on tag

Ready for realease on tag #2

Workflow file for this run

# Build and release the project to GitHub Packages using Windows-Server-2022
name: Build and release new version
# Only deploy when a new tag is pushed
on:
push:
tags:
- "v*.*.*"
- "v*.*-alpha"
# branches: [ master ]
#pull_request:
# branches: [ master ]
# Allow this workflow to write back to the repository
permissions:
contents: write
# Create variabele app_name and solution folder
env:
app_name: PicoSystemInfoNesLoader
solution_folder: PicoNesLoader
# Build binary and send to releases
jobs:
build-release:
runs-on: windows-latest
name: Build and release
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: List current Directory
run: dir
- name: Update VersionInfo.cs with associated tag if it exists
run: |
# Extract the tag name that triggered the event and remove the 'refs/tags/' prefix
# change directory to the solution folder
cd $env:solution_folder
$inputString = $env:GITHUB_REF
write-host "Input string is $inputString"
$prefix = "refs/tags/"
$tag = "No versioninfo found"
if ($inputString.StartsWith($prefix)) {
Write-Host "The string starts with 'refs/tags/'."
$tag = $inputString.Substring($prefix.Length)
Write-Host "Tag is $tag"
(Get-Content -Path VersionInfo.cs) | ForEach-Object { $_ -replace "DEVVERSION", $tag } | Set-Content -Path VersionInfo.cs
} else {
Write-Host "The string does not start with 'refs/tags/'."
}
Get-Content -Path VersionInfo.cs
- name: Install dependencies
run: dotnet restore
working-directory: ${{ env.solution_folder }}
- name : Build
run: dotnet build --configuration Release --no-restore
working-directory: ${{ env.solution_folder }}
- name: create publish/$app_name folder
run: |
mkdir publish
mkdir publish\$env:app_name
working-directory: ${{ env.solution_folder }}
- name: Publish
run: dotnet publish -c Release -r win-x86 --self-contained true -p:PublishSingleFile=true -p:PublishReadyToRun=true --output ./publish/$env:app_name
working-directory: ${{ env.solution_folder }}
- name: List contents of publish folder
run: dir
working-directory: ${{ env.solution_folder }}\publish
- name: zip folder publish/$app_name
run: Compress-Archive -Path $env:app_name -DestinationPath ..\..\$env:app_name.zip
working-directory: ${{ env.solution_folder }}\publish
- name: list current directory
run: dir
- name: Push to release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.app_name }}.zip
body_path: CHANGELOG.md