NuGet #175
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: NuGet | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: # This enables the manual button | |
| inputs: | |
| reason: | |
| description: 'Please describe why are you running this manually?' | |
| required: false | |
| default: 'Manual test' | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_VERSION: 10.0.x | |
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check trigger reason | |
| run: | | |
| echo "Triggered because: ${{ github.event.inputs.reason }}" | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Install dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Test | |
| run: dotnet test --no-restore --verbosity normal | |
| pack: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Pack | |
| run: | | |
| arrTag=(${GITHUB_REF//\// }) | |
| VERSION="${arrTag[2]}" | |
| echo Version before: $VERSION | |
| VERSION="${VERSION//v}" | |
| echo Version after: $VERSION | |
| echo "dotnet pack -c Release -p:PackageVersion=$VERSION BeaKona.AutoInterfaceGenerator" | |
| dotnet pack -c Release -p:PackageVersion=$VERSION BeaKona.AutoInterfaceGenerator | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nupkg-${{ matrix.runs-on }} | |
| path: ./**/bin/Release/*.nupkg | |
| push: | |
| needs: pack | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Download Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: nupkg | |
| pattern: nupkg-* | |
| merge-multiple: true | |
| - name: List directory | |
| run: ls -R | |
| - name: Push to nuget.org | |
| run: dotnet nuget push ./nupkg/**/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NugetApiKey }} |