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: Release - Publish NuGet Packages | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: read | |
| id-token: write | |
| steps: | |
| # SETUP | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| source-url: https://nuget.pkg.github.com/marcopicker/index.json | |
| env: | |
| NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Set package version from tag (e.g., v1.2.3 → 1.2.3) | |
| - name: Extract version from tag | |
| run: echo "PACKAGE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
| # Build | |
| - name: Build EasyPrefs | |
| run: dotnet build EasyPrefs/EasyPrefs.csproj -c Release | |
| - name: Build EasyPrefs.JSON | |
| run: dotnet build EasyPrefs.JSON/EasyPrefs.JSON.csproj -c Release | |
| # Pack with the release version | |
| - name: Pack EasyPrefs | |
| run: dotnet pack EasyPrefs/EasyPrefs.csproj -c Release -o ./artifacts /p:PackageVersion=${{ env.PACKAGE_VERSION }} | |
| - name: Pack EasyPrefs.JSON | |
| run: dotnet pack EasyPrefs.JSON/EasyPrefs.JSON.csproj -c Release -o ./artifacts /p:PackageVersion=${{ env.PACKAGE_VERSION }} | |
| # Get NuGet API key | |
| - name: NuGet login | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| # Publish packages | |
| - name: Publish NuGet packages to GitHub | |
| run: dotnet nuget push ./artifacts/EasyPrefs.*.nupkg | |
| - name: Publish NuGet packages to NuGet | |
| run: dotnet nuget push ./artifacts/EasyPrefs.*.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json |