Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 📦 Publish Testimize NuGet Package | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' # Triggers on core version tags like v1.1.8 | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Override package version (optional, e.g. 1.1.9)' | |
| required: false | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| publish: | |
| name: Publish Testimize to NuGet.org | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.x' | |
| - name: Resolve Package Version | |
| id: version | |
| shell: bash | |
| run: | | |
| if [ -n "${{ github.event.inputs.version }}" ]; then | |
| echo "value=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT" | |
| elif [[ "${GITHUB_REF}" == refs/tags/v* ]]; then | |
| echo "value=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "value=" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Restore Dependencies | |
| run: dotnet restore ./Testimize/Testimize.csproj | |
| - name: Build Project | |
| run: dotnet build ./Testimize/Testimize.csproj --configuration Release --no-restore | |
| - name: Pack NuGet Package | |
| run: | | |
| if [ -n "${{ steps.version.outputs.value }}" ]; then | |
| dotnet pack ./Testimize/Testimize.csproj \ | |
| --configuration Release --no-build \ | |
| -p:Version=${{ steps.version.outputs.value }} \ | |
| --output ./nupkg | |
| else | |
| dotnet pack ./Testimize/Testimize.csproj \ | |
| --configuration Release --no-build \ | |
| --output ./nupkg | |
| fi | |
| - name: Push to NuGet.org | |
| run: | | |
| dotnet nuget push ./nupkg/Testimize.*.nupkg \ | |
| --api-key ${{ secrets.NUGETKEY }} \ | |
| --source https://api.nuget.org/v3/index.json \ | |
| --skip-duplicate | |
| - name: Upload Package Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: testimize-nupkg | |
| path: ./nupkg/*.nupkg |