Repository navigation
Publish #52
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 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - '.github/workflows/publish.yml' | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'build/**' | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| packages: write | |
| env: | |
| # Disable the .NET logo in the console output. | |
| DOTNET_NOLOGO: true | |
| # Disable the .NET first time experience to skip caching NuGet packages and speed up the build. | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| # Disable sending .NET CLI telemetry to Microsoft. | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| jobs: | |
| publish-moduleloader: | |
| name: Publish Bannerlord.ModuleLoader | |
| runs-on: windows-2022 | |
| steps: | |
| - name: Setup | |
| uses: butr/actions-common-setup@v2 | |
| with: | |
| github-token: ${{secrets.GITHUB_TOKEN}} | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@v2 | |
| with: | |
| msbuild-architecture: x64 | |
| - name: Run Bannerlord.ModuleLoader | |
| run: >- | |
| dotnet restore src/Bannerlord.ModuleLoader/Bannerlord.ModuleLoader.csproj; | |
| msbuild src/Bannerlord.ModuleLoader/Bannerlord.ModuleLoader.csproj -t:Pack /p:configuration=Release /p:PackageOutputPath="./../../packages"; | |
| shell: pwsh | |
| - 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 | |
| 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 | |
| shell: bash | |
| publish-moduleloader-injector: | |
| name: Publish Bannerlord.ModuleLoader.Injector | |
| runs-on: ubuntu-latest | |
| needs: publish-moduleloader | |
| steps: | |
| - name: Setup | |
| uses: butr/actions-common-setup@v2 | |
| with: | |
| github-token: ${{secrets.GITHUB_TOKEN}} | |
| - name: Run Bannerlord.ModuleLoader | |
| run: dotnet pack src/Bannerlord.ModuleLoader.Injector/Bannerlord.ModuleLoader.Injector.csproj --configuration Release -o "./packages"; | |
| shell: pwsh | |
| - 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 | |
| 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 |