Repository navigation
Merge pull request #372 from BUTR/trusted-publishing #86
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: Publish NuGet | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - '.github/workflows/publish-nuget.yml' | |
| - 'src/Bannerlord.ModuleManager/**.cs' | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| packages: write | |
| jobs: | |
| publish: | |
| name: Publish on NuGet and GPR | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3.3.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET 8 | |
| uses: actions/setup-dotnet@master | |
| with: | |
| dotnet-version: 8.x.x | |
| - run: dotnet pack -c Release src/Bannerlord.ModuleManager.Models -p:VersionOverride=$(git rev-list --no-merges --count master) -o ./packages | |
| - run: dotnet pack -c Release src/Bannerlord.ModuleManager -p:VersionOverride=$(git rev-list --no-merges --count master) -o ./packages | |
| - run: dotnet pack -c Release src/Bannerlord.ModuleManager.Source -p:VersionOverride=$(git rev-list --no-merges --count master) -o ./packages | |
| - name: NuGet login (trusted publishing) | |
| uses: NuGet/login@v1 | |
| id: nuget-login | |
| with: | |
| user: Aragas | |
| - name: Push to NuGet | |
| run: dotnet nuget push "./packages/*.nupkg" -k ${{ steps.nuget-login.outputs.NUGET_API_KEY }} -s https://www.nuget.org --skip-duplicate | |
| shell: pwsh | |
| - name: Push to GPR | |
| run: | | |
| for f in ./packages/*.nupkg | |
| do | |
| curl -vX PUT -u "vslee:${{secrets.GITHUB_TOKEN}}" -F package=@$f https://nuget.pkg.github.com/BUTR/ | |
| done |