Bump actions/upload-artifact from 5 to 6 #440
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: CI | |
| on: [push, pull_request] | |
| permissions: | |
| actions: write | |
| contents: write | |
| id-token: write | |
| jobs: | |
| build: | |
| name: .NET on ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET Core | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Build | |
| run: dotnet build -c Release ValveKeyValue/ValveKeyValue.sln | |
| - name: Test | |
| run: dotnet test -c Release ValveKeyValue/ValveKeyValue.Test/ValveKeyValue.Test.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput='./lcov.info' /p:Include="[ValveKeyValue*]*" | |
| - name: Create nupkg | |
| run: dotnet pack --configuration Release ValveKeyValue/ValveKeyValue/ValveKeyValue.csproj | |
| - name: Upload nupkg | |
| uses: actions/upload-artifact@v6 | |
| if: matrix.os == 'ubuntu-latest' | |
| with: | |
| name: nupkg | |
| path: 'ValveKeyValue/ValveKeyValue/bin/Release/*.nupkg' | |
| - name: Upload test coverage | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./ValveKeyValue/ValveKeyValue.Test/lcov.info | |
| fail_ci_if_error: true | |
| verbose: true | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: nupkg | |
| path: artifacts | |
| - name: Rename nupkg | |
| run: mv artifacts/ValveKeyValue.*.nupkg artifacts/ValveKeyValue.nupkg | |
| - name: Display artifacts folder structure | |
| run: ls -Rl | |
| working-directory: artifacts | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| files: artifacts/ValveKeyValue.nupkg | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: NuGet login | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| - name: Publish to NuGet Gallery | |
| run: dotnet nuget push artifacts/ValveKeyValue.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }}--source "https://api.nuget.org/v3/index.json" |