Skip to content

v1.5.0

v1.5.0 #8

Workflow file for this run

name: Publish to NuGet
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Package version'
required: true
type: string
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Determine version
id: version
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}" # Remove 'v' prefix if present
else
VERSION="${{ github.event.inputs.version }}"
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build
run: |
dotnet build TriasDev.Templify/TriasDev.Templify.csproj \
--configuration Release \
-p:Version=${{ steps.version.outputs.VERSION }}
- name: Run tests
run: |
dotnet test TriasDev.Templify.Tests/TriasDev.Templify.Tests.csproj \
--configuration Release \
--no-build \
--verbosity normal
- name: Pack
run: |
dotnet pack TriasDev.Templify/TriasDev.Templify.csproj \
--configuration Release \
--no-build \
-p:Version=${{ steps.version.outputs.VERSION }} \
--output ./artifacts
- name: Push to NuGet
run: |
dotnet nuget push ./artifacts/*.nupkg \
--source https://api.nuget.org/v3/index.json \
--api-key ${{ secrets.NUGET_API_KEY }} \
--skip-duplicate
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./artifacts/*.nupkg