@@ -5,15 +5,13 @@ concurrency:
55 cancel-in-progress : true
66
77on :
8- workflow_dispatch : # Allow running the workflow manually from the GitHub UI
9- push :
10- branches :
11- - ' main ' # Run the workflow when pushing to the main branch
8+ workflow_run :
9+ workflows : [.NET]
10+ types :
11+ - completed
1212
1313env :
14- servicelocator_sln : " vb2ae.ServiceLocator.MSDependencyInjection.sln"
1514 package_feed : " https://api.nuget.org/v3/index.json"
16- nuget_folder : " \\ packages"
1715
1816jobs :
1917 deployment :
@@ -25,12 +23,26 @@ jobs:
2523 uses : actions/setup-dotnet@v4
2624 with :
2725 dotnet-version : 9.0.x
28- - name : Restore dependencies
29- run : dotnet restore ${{env.servicelocator_sln}}
30- - name : Build
31- run : dotnet build ${{env.servicelocator_sln}} --no-restore --configuration Release
32- - name : Pack Nuget
33- run : dotnet pack ${{env.servicelocator_sln}} --output ${{env.nuget_folder}}
26+ - name : Get run ID of "Build" workflow
27+ id : get-run-id
28+ run : |
29+ REPO_NAME="${{ github.repository }}"
30+ WF_NAME="dotnet.yml"
31+ RUN_ID=`gh run --repo ${REPO_NAME} list --workflow ${WF_NAME} --json databaseId --jq .[0].databaseId`
32+ echo "Detected latest run id of ${RUN_ID} for workflow ${WF_NAME}"
33+ echo "run-id=${RUN_ID}" >> "$GITHUB_OUTPUT"
34+ env :
35+ GH_TOKEN : ${{ github.token }}
36+ - name : Download artifact from "Build" workflow
37+ uses : actions/download-artifact@v4
38+ with :
39+ name : published_nuget # Match name used in dotnet-core.yml upload artifact step
40+ github-token : ${{ github.token }}
41+ repository : ${{ github.repository }}
42+ run-id : ${{ steps.get-run-id.outputs.run-id }}
43+ - name : Display structure of downloaded files
44+ run : ls -R
45+
3446
3547 - name : publish Nuget Packages to GitHub
3648 run : dotnet nuget push packages/*.nupkg --source ${{env.package_feed}} --api-key ${{secrets.PUBLISH_TO_NUGET}} --skip-duplicate
0 commit comments