2929 echo "NUGET_API_KEY_DEFINED=true" >> $env:GITHUB_ENV
3030 }
3131
32+ if ('${{ secrets.NPM_API_KEY }}') {
33+ Write-Host "NPM_API_KEY secret detected. NPM packages will be pushed."
34+ echo "NPM_API_KEY_DEFINED=true" >> $env:GITHUB_ENV
35+ }
36+
3237 - name : 🔎 Search for build of ${{ github.ref }}
3338 shell : pwsh
3439 id : findrunid
7782 - name : 🔏 Code sign
7883 shell : pwsh
7984 run : >
85+ rm global.json # avoid a need to install a particular SDK version
86+
8087 dotnet tool install --tool-path obj SignClient
8188
8289 obj/SignClient sign
@@ -91,11 +98,11 @@ jobs:
9198
9299 - name : 💽 Upload artifacts to release
93100 shell : pwsh
94- if : ${{ github.event.release.assets_url }} != ''
101+ if : ${{ github.event_name == 'release' && github. event.release.assets_url != '' }}
95102 env :
96103 GH_TOKEN : ${{ github.token }}
97104 run : |
98- Get-ChildItem '${{ runner.temp }}/deployables' |% {
105+ Get-ChildItem '${{ runner.temp }}/deployables' -File -Recurse |% {
99106 Write-Host "Uploading $($_.Name) to release..."
100107 gh release -R ${{ github.repository }} upload "${{ github.ref_name }}" $_.FullName
101108 }
@@ -105,10 +112,10 @@ jobs:
105112 if : ${{ env.NUGET_API_KEY_DEFINED == 'true' }}
106113
107114 - name : 🚀 Push NPM packages
115+ shell : pwsh
108116 run : |
109- npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_API_KEY }}
117+ npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_API_KEY }}
110118 Get-ChildItem '${{ runner.temp }}/deployables/*.tgz' |% {
111119 npm publish $_ --registry=https://registry.npmjs.org/
112120 }
113- env :
114- NPM_AUTH_TOKEN : ${{ secrets.NPM_API_KEY }}
121+ if : ${{ env.NPM_API_KEY_DEFINED == 'true' }}
0 commit comments