Publish Nuget #376
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: | |
| workflow_run: | |
| workflows: ['ci'] | |
| types: | |
| - completed | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Dump GitHub context | |
| env: | |
| GITHUB_CONTEXT: ${{ toJson(github) }} | |
| run: echo "$GITHUB_CONTEXT" | |
| - uses: nuget/setup-nuget@v1 | |
| with: | |
| nuget-version: '5.x' | |
| - name: Download artifact | |
| uses: dawidd6/action-download-artifact@v2 | |
| if: github.event.workflow_run.conclusion == 'success' | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| workflow: ci.yml | |
| run_id: ${{ github.event.id }} | |
| name: nuget | |
| # - uses: actions/download-artifact@v2 | |
| # with: | |
| # name: nuget | |
| - name: nuget.org | |
| # continue-on-error: true | |
| if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && startsWith(github.event.workflow_run.head_branch, 'v') # this is the best approximation for a tag | |
| env: | |
| ApiKey: ${{ secrets.RSG_NUGET_API_KEY }} | |
| shell: pwsh | |
| run: | | |
| dotnet nuget push **/*.nupkg --skip-duplicate -s nuget.org --api-key $ENV:ApiKey | |
| dotnet nuget push **/*.snupkg --skip-duplicate -s nuget.org --api-key $ENV:ApiKey | |
| - name: dev.azure.com | |
| # continue-on-error: true | |
| if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' | |
| env: | |
| ApiKey: ${{ secrets.RSG_AZURE_DEVOPS }} | |
| shell: pwsh | |
| run: | | |
| dotnet nuget add source https://rocketsurgeonsguild.pkgs.visualstudio.com/Libraries/_packaging/Packages/nuget/v3/index.json --store-password-in-clear-text --name LibrariesPackages --username azuredevops --password $ENV:ApiKey | |
| dotnet nuget push **/*.nupkg --skip-duplicate --api-key azuredevops --source LibrariesPackages | |
| - name: preview.dev.azure.com | |
| # continue-on-error: true | |
| if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' | |
| env: | |
| ApiKey: ${{ secrets.RSG_AZURE_DEVOPS }} | |
| shell: pwsh | |
| run: | | |
| dotnet nuget add source https://rocketsurgeonsguild.pkgs.visualstudio.com/Libraries/_packaging/Preview/nuget/v3/index.json --store-password-in-clear-text --name LibrariesPreview --username azuredevops --password $ENV:ApiKey | |
| dotnet nuget push **/*.nupkg --skip-duplicate --api-key azuredevops --source LibrariesPreview |