update repo assist #185
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: Pack & Publish Nuget | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| #contents: write # for peaceiris/actions-gh-pages | |
| id-token: write # for NuGet trusted publishing | |
| jobs: | |
| publish: | |
| name: Publish nuget (if new version) | |
| runs-on: windows-latest | |
| steps: | |
| # checkout the code | |
| - name: checkout-code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| # setup dotnet based on global.json | |
| - name: setup-dotnet | |
| uses: actions/setup-dotnet@v4 | |
| # cache NuGet packages to avoid re-downloading on every run | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: nuget-${{ runner.os }}-${{ hashFiles('**/*.fsproj', '**/*.csproj', 'global.json') }} | |
| restore-keys: nuget-${{ runner.os }}- | |
| # build it, test it, pack it, publish it | |
| - name: Run dotnet build (release, for nuget) | |
| # see issue #105 and #243 | |
| # very important, since we use cmd scripts, the default is psh, and a bug prevents errorlevel to bubble | |
| shell: cmd | |
| run: ./build.cmd | |
| - name: Obtain NuGet key | |
| # this hash is v1.1.0 | |
| uses: NuGet/login@d22cc5f58ff5b88bf9bd452535b4335137e24544 | |
| id: login | |
| with: | |
| user: dsyme | |
| - name: Publish NuGets (if this version not published before) | |
| run: dotnet nuget push packages\FSharp.Control.TaskSeq.*.nupkg -s https://www.nuget.org/api/v2/package -k ${{ steps.login.outputs.NUGET_API_KEY }} --skip-duplicate |