v0.23.1 #43
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 NuGet | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| build-and-test: | |
| strategy: | |
| matrix: | |
| os: [macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| - name: Install workloads | |
| run: dotnet workload install maui macos | |
| - name: Restore | |
| run: dotnet restore ci.slnf | |
| - name: Build | |
| run: dotnet build ci.slnf -c Release --no-restore | |
| - name: Test | |
| run: dotnet test ci.slnf -c Release --no-build --no-restore | |
| publish: | |
| needs: build-and-test | |
| runs-on: windows-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| - name: Install workloads | |
| run: dotnet workload install maui macos | |
| - name: Restore | |
| run: dotnet restore ci.slnf | |
| - name: Determine version | |
| id: version | |
| shell: bash | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| # Strip leading 'v' if present (e.g., v1.2.3 -> 1.2.3) | |
| VERSION="${TAG#v}" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "Publishing version: $VERSION" | |
| - name: Build | |
| run: dotnet build ci.slnf -c Release --no-restore -p:Version=${{ steps.version.outputs.version }} | |
| - name: Test | |
| run: dotnet test ci.slnf -c Release --no-build --no-restore | |
| - name: Pack | |
| run: dotnet pack ci.slnf -c Release --no-build -o ./artifacts -p:PackageVersion=${{ steps.version.outputs.version }} | |
| - name: Upload NuGet packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-packages | |
| path: ./artifacts/*.nupkg | |
| - name: Push to NuGet.org | |
| shell: bash | |
| run: | | |
| for pkg in ./artifacts/*.nupkg; do | |
| dotnet nuget push "$pkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| done |