Bump to 0.1.3 and set package validation baseline to 0.1.2 #24
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: | |
| branches: [ main ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Package version to publish from its existing v* tag | |
| required: true | |
| type: string | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/v{0}', inputs.version) || github.ref }} | |
| - uses: actions/setup-dotnet@v6 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Determine version | |
| id: ver | |
| run: | | |
| if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then | |
| echo "arg=-p:Version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| echo "arg=-p:Version=${{ inputs.version }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "arg=" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Restore | |
| run: dotnet restore PrivacyFilter.Net.sln | |
| - name: Build | |
| run: dotnet build PrivacyFilter.Net.sln -c Release --no-restore ${{ steps.ver.outputs.arg }} | |
| - name: Test | |
| run: dotnet test PrivacyFilter.Net.sln -c Release --no-build --verbosity normal | |
| - name: Pack | |
| run: dotnet pack src/PrivacyFilter.Net/PrivacyFilter.Net.csproj -c Release --no-build -o artifacts ${{ steps.ver.outputs.arg }} | |
| - name: Upload package artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: nupkg | |
| path: artifacts/* | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Download package artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: nupkg | |
| path: artifacts | |
| - name: NuGet login | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ericstj | |
| - name: Publish to NuGet.org | |
| run: > | |
| dotnet nuget push "artifacts/*.nupkg" | |
| --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" | |
| --source https://api.nuget.org/v3/index.json | |
| --skip-duplicate |