11name : Component Detection CI
22
3- on :
3+ on :
44 push :
5- branches :
5+ branches :
66 - main
7+ pull_request :
8+ release :
9+ types :
10+ - published
11+ workflow_dispatch :
712
813jobs :
914 build :
3843 - name : Tar the output
3944 run : tar -C ./dist -cvf ./dist-release/component-detection.tar.gz .
4045
41- - name : Create a release draft
42- id : create_release_draft
43- uses : release-drafter/release-drafter@v5
44- with :
45- disable-autolabeler : true
46- env :
47- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
48-
4946 - name : Upload Extension Release Asset
5047 id : upload-component-detection-release-asset
51- if : startsWith( github.ref, 'refs/tags/')
48+ if : github.event_name == 'release'
5249 uses : actions/upload-release-asset@v1.0.2
5350 env :
5451 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -59,18 +56,18 @@ jobs:
5956 asset_content_type : application/zip
6057
6158 - name : Add NuGet publication source for Github packages
62- if : startsWith( github.ref, 'refs/tags/')
59+ if : github.event_name == 'release'
6360 run : dotnet nuget add source https://nuget.pkg.github.com/microsoft/index.json --password $GITHUB_TOKEN --username notused --store-password-in-clear-text --name cgwriter
6461 env :
6562 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6663
6764 - name : Generate NuGet packages
68- if : startsWith( github.ref, 'refs/tags/')
65+ if : github.event_name == 'release'
6966 run : dotnet pack -o dist-nuget -c Release
7067
7168 # dotnet nuget push seems to have some probs, use curl for GH
7269 - name : Publish nuget
73- if : startsWith( github.ref, 'refs/tags/')
70+ if : github.event_name == 'release'
7471 run : |
7572 for f in ./dist-nuget/*.nupkg
7673 do
0 commit comments