Deployment #180
  
    
      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: Deployment | |
| concurrency: | |
| group: production | |
| cancel-in-progress: true | |
| on: | |
| workflow_run: | |
| workflows: [.NET] | |
| types: | |
| - completed | |
| env: | |
| package_feed: "https://api.nuget.org/v3/index.json" | |
| jobs: | |
| deployment: | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Get run ID of "Build" workflow | |
| id: get-run-id | |
| run: | | |
| REPO_NAME="${{ github.repository }}" | |
| WF_NAME="dotnet.yml" | |
| RUN_ID=`gh run --repo ${REPO_NAME} list --workflow ${WF_NAME} --json databaseId --jq .[0].databaseId` | |
| echo "Detected latest run id of ${RUN_ID} for workflow ${WF_NAME}" | |
| echo "run-id=${RUN_ID}" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Download artifact from "Build" workflow | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: published_nuget # Match name used in dotnet-core.yml upload artifact step | |
| github-token: ${{ github.token }} | |
| repository: ${{ github.repository }} | |
| run-id: ${{ steps.get-run-id.outputs.run-id }} | |
| - name: Display structure of downloaded files | |
| run: ls -R | |
| - name: publish Nuget Packages to GitHub | |
| run: dotnet nuget push *.nupkg --source ${{env.package_feed}} --api-key ${{secrets.PUBLISH_TO_NUGET}} --skip-duplicate |