Skip to content

Commit 54f5e8a

Browse files
committed
add script to upload nuget packages as release artifacts
1 parent 5f666ae commit 54f5e8a

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/publish.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,23 @@ jobs:
5555
with:
5656
name: nupkg
5757
path: nupkg
58-
- name: Publish Nuget packages to GitHub registry
59-
run: dotnet nuget push "nupkg/*" -k ${{secrets.NUGET_API_KEY}}
58+
- name: Publish Nuget packages to Nuget registry
59+
run: dotnet nuget push "nupkg/*" -k ${{secrets.NUGET_API_KEY}}
60+
- name: Upload Nuget packages as release artifacts
61+
uses: actions/github-script@v6
62+
with:
63+
github-token: ${{secrets.GITHUB_TOKEN}}
64+
script: |
65+
console.log('environment', process.versions);
66+
const fs = require('fs').promises;
67+
const { repo: { owner, repo }, sha } = context;
68+
for (let file of await fs.readdir('nupkg')) {
69+
console.log('uploading', file);
70+
await github.rest.repos.uploadReleaseAsset({
71+
owner,
72+
repo,
73+
release_id: ${{ github.event.release.id }},
74+
name: file,
75+
data: await fs.readFile(`nupkg/${file}`)
76+
});
77+
}

0 commit comments

Comments
 (0)