Skip to content

fix(patching): harden IL merge and delegate retargeting #51

fix(patching): harden IL merge and delegate retargeting

fix(patching): harden IL merge and delegate retargeting #51

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET CI/CD
on:
push:
branches: [ "main", "pre-release/upstream" ]
jobs:
build-and-release:
runs-on: windows-latest
permissions:
contents: write
packages: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v1
with:
versionSpec: '5.x'
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v1
- name: Select GitHub Packages token
id: package_token
shell: pwsh
env:
OTAPI_PACKAGES_READ_TOKEN: ${{ secrets.OTAPI_PACKAGES_READ_TOKEN }}
GITHUB_TOKEN_FALLBACK: ${{ secrets.GITHUB_TOKEN }}
run: |
if ([string]::IsNullOrWhiteSpace($env:OTAPI_PACKAGES_READ_TOKEN)) {
"token=$env:GITHUB_TOKEN_FALLBACK" >> $env:GITHUB_OUTPUT
"token_source=GITHUB_TOKEN" >> $env:GITHUB_OUTPUT
} else {
"token=$env:OTAPI_PACKAGES_READ_TOKEN" >> $env:GITHUB_OUTPUT
"token_source=OTAPI_PACKAGES_READ_TOKEN" >> $env:GITHUB_OUTPUT
}
- name: Authenticate GitHub Packages source
shell: pwsh
run: |
dotnet nuget update source github-cedarycat `
--source "https://nuget.pkg.github.com/CedaryCat/index.json" `
--username "${{ github.actor }}" `
--password "${{ steps.package_token.outputs.token }}" `
--store-password-in-clear-text `
--configfile NuGet.config
- name: Show submodule status
shell: pwsh
run: |
git submodule status --recursive
- name: Restore dependencies
shell: pwsh
run: |
dotnet restore src/OTAPI.UnifiedServerProcess/OTAPI.UnifiedServerProcess.csproj --configfile NuGet.config
if ($LASTEXITCODE -ne 0) {
Write-Host "::error::Restore failed. Check CedaryCat/otapi-packaging package visibility, package Actions access, and token scopes (read:packages)."
exit $LASTEXITCODE
}
- name: Build project with version
run: >
dotnet build src/OTAPI.UnifiedServerProcess/OTAPI.UnifiedServerProcess.csproj
--configuration Release
/p:GitVersion_NuGetVersion=${{ steps.gitversion.outputs.nuGetVersionV2 }}
/p:GitVersion_AssemblySemVer=${{ steps.gitversion.outputs.assemblySemVer }}
/p:GitVersion_AssemblySemFileVer=${{ steps.gitversion.outputs.assemblySemFileVer }}
/p:GitVersion_InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }}
- name: Run compiled EXE
run: |
cd src/OTAPI.UnifiedServerProcess/bin/Release/net9.0
.\OTAPI.UnifiedServerProcess.exe
- name: Create output zip file
run: |
$version = "${{ steps.gitversion.outputs.semVer }}"
$outputDir = "src/OTAPI.UnifiedServerProcess/bin/Release/net9.0/output"
$zipPath = "UnifiedServerProcess-v$version.zip"
Compress-Archive -Path "$outputDir\*" -DestinationPath "$zipPath"
echo "Created zip at $zipPath"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.gitversion.outputs.semVer }}
release_name: Release v${{ steps.gitversion.outputs.semVer }}
draft: false
prerelease: ${{ github.ref == 'refs/heads/pre-release/upstream' }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./UnifiedServerProcess-v${{ steps.gitversion.outputs.semVer }}.zip
asset_name: UnifiedServerProcess-v${{ steps.gitversion.outputs.semVer }}.zip
asset_content_type: application/zip