|
| 1 | +# This workflow will publish a package when a release is created |
| 2 | + |
| 3 | +name: Publish package to NuGet repository |
| 4 | +on: |
| 5 | + release: |
| 6 | + types: [created] |
| 7 | +jobs: |
| 8 | + publish-nuget: |
| 9 | + runs-on: windows-latest |
| 10 | + steps: |
| 11 | + - name: Checkout repository |
| 12 | + uses: actions/checkout@v1 |
| 13 | + - name: Setup .NET Core @ Latest |
| 14 | + uses: actions/setup-dotnet@v1 |
| 15 | + with: |
| 16 | + dotnet-version: '3.1.x' |
| 17 | + env: |
| 18 | + NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }} |
| 19 | + - name: Build solution and generate NuGet package |
| 20 | + run: | |
| 21 | + cd contentstack-utils-dotnet |
| 22 | + dotnet pack -c Release -o out |
| 23 | +
|
| 24 | + - name: Push generated package to GitHub registry |
| 25 | + run: dotnet nuget push ./contentstack-utils-dotnet/out/*.nupkg --api-key $NUGET_AUTH_TOKEN --skip-duplicate --no-symbols true |
| 26 | + |
| 27 | + publish-git: |
| 28 | + runs-on: windows-latest |
| 29 | + steps: |
| 30 | + - name: Checkout repository |
| 31 | + uses: actions/checkout@v1 |
| 32 | + - name: Setup .NET Core @ Latest |
| 33 | + uses: actions/setup-dotnet@v1 |
| 34 | + with: |
| 35 | + dotnet-version: '3.1.x' |
| 36 | + source-url: https://nuget.pkg.github.com/Contentstack/index.json |
| 37 | + env: |
| 38 | + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + - name: Build solution and generate NuGet package |
| 40 | + run: | |
| 41 | + cd contentstack-utils-dotnet |
| 42 | + dotnet pack -c Release -o out |
| 43 | +
|
| 44 | + - name: Push generated package to GitHub registry |
| 45 | + run: dotnet nuget push ./contentstack-utils-dotnet/out/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --no-symbols true |
0 commit comments