Skip to content

Release v0.2.0: tests, docs, Avalonia sample, and CI Test target. #6

Release v0.2.0: tests, docs, Avalonia sample, and CI Test target.

Release v0.2.0: tests, docs, Avalonia sample, and CI Test target. #6

Workflow file for this run

name: Publish NuGet
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Package version (e.g. 1.0.1)"
required: true
permissions:
contents: read
jobs:
publish:
if: contains(fromJson('["MvvmAIO","Skymly","wys0610"]'), github.actor)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup .NET 10 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-quality: "preview"
- name: Resolve version
shell: bash
run: |
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
VERSION="${{ github.event.inputs.version }}"
elif [[ "${GITHUB_REF_NAME}" == v* ]]; then
VERSION="${GITHUB_REF_NAME#v}"
else
echo "Error: tag must start with 'v'. Current tag: ${GITHUB_REF_NAME}"
exit 1
fi
echo "Publishing version: ${VERSION}"
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
- name: Pack and publish via Nuke
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
dotnet run --project "build/_build.csproj" -- --target Publish --configuration Release --version "$env:VERSION" --nuget-api-key "${{ secrets.NUGET_API_KEY }}" 2>&1 | Tee-Object -FilePath publish.log
- name: Upload publish log
if: always()
uses: actions/upload-artifact@v4
with:
name: nuget-publish-log
path: ./publish.log
if-no-files-found: warn
- name: Upload package artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: |
MvvmAIO.Markup.WPF/bin/Release/*.nupkg
MvvmAIO.Markup.Avalonia/bin/Release/*.nupkg
if-no-files-found: warn
- name: Write publish summary
if: always()
shell: bash
run: |
{
echo "## NuGet Publish Summary"
echo ""
echo "- Version: \`${VERSION:-unknown}\`"
echo "- Trigger: \`${GITHUB_EVENT_NAME}\`"
echo "- Ref: \`${GITHUB_REF}\`"
echo "- Actor: \`${GITHUB_ACTOR}\`"
echo "- Job status: \`${{ job.status }}\`"
echo ""
echo "### Artifacts"
echo "- \`nuget-publish-log\`"
echo "- \`nuget-packages\` (.nupkg files, if any)"
} >> "$GITHUB_STEP_SUMMARY"