Skip to content

Release 0.0.11 static assets startup fix #17

Release 0.0.11 static assets startup fix

Release 0.0.11 static assets startup fix #17

Workflow file for this run

name: Release
on:
push:
branches: [main]
workflow_dispatch:
inputs:
force:
description: Rebuild and publish even when the GitHub Release already exists.
required: false
default: false
type: boolean
permissions:
contents: write
packages: write
jobs:
pack:
runs-on: ubuntu-latest
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v7.0.0
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5.4.0
with:
dotnet-version: 10.0.x
- name: Resolve release version
id: release
env:
FORCE_RELEASE: ${{ github.event_name == 'workflow_dispatch' && inputs.force }}
GH_TOKEN: ${{ github.token }}
run: |
version=$(dotnet msbuild src/ManagedCode.LlmTck/ManagedCode.LlmTck.csproj -nologo -v:q -getProperty:Version)
tag="v$version"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
if gh release view "$tag" > /dev/null 2>&1 && [ "$FORCE_RELEASE" != "true" ]; then
echo "should_release=false" >> "$GITHUB_OUTPUT"
echo "::notice::Release $tag already exists; skipping package publish."
else
echo "should_release=true" >> "$GITHUB_OUTPUT"
fi
- name: Restore
if: ${{ steps.release.outputs.should_release == 'true' }}
run: dotnet restore ManagedCode.LlmTck.slnx
- name: Format
if: ${{ steps.release.outputs.should_release == 'true' }}
run: dotnet format ManagedCode.LlmTck.slnx --verify-no-changes --no-restore
- name: Build
if: ${{ steps.release.outputs.should_release == 'true' }}
run: dotnet build ManagedCode.LlmTck.slnx --configuration Release --no-restore
- name: Test
if: ${{ steps.release.outputs.should_release == 'true' }}
run: dotnet test tests/ManagedCode.LlmTck.Tests/ManagedCode.LlmTck.Tests.csproj --configuration Release --no-build --verbosity normal
- name: Pack
if: ${{ steps.release.outputs.should_release == 'true' }}
run: for project in src/*/*.csproj; do dotnet pack "$project" --configuration Release --no-build --output artifacts/packages; done
- name: Publish container image
if: ${{ steps.release.outputs.should_release == 'true' }}
env:
IMAGE_TAG: ${{ steps.release.outputs.version }}
run: |
echo "${{ github.token }}" | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
docker build \
-f samples/ManagedCode.LlmTck.Service/Dockerfile \
-t "ghcr.io/managedcode/llm-tck:$IMAGE_TAG" \
.
docker push "ghcr.io/managedcode/llm-tck:$IMAGE_TAG"
- name: Create GitHub release
if: ${{ steps.release.outputs.should_release == 'true' }}
env:
GH_TOKEN: ${{ github.token }}
TAG_NAME: ${{ steps.release.outputs.tag }}
run: |
if gh release view "$TAG_NAME" > /dev/null 2>&1; then
gh release upload "$TAG_NAME" artifacts/packages/*.nupkg --clobber
else
gh release create "$TAG_NAME" artifacts/packages/*.nupkg --title "$TAG_NAME" --generate-notes --target "$GITHUB_SHA"
fi
- name: Publish packages
if: ${{ steps.release.outputs.should_release == 'true' && env.NUGET_API_KEY != '' }}
run: dotnet nuget push "artifacts/packages/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" --skip-duplicate