Skip to content

Commit 6e0d338

Browse files
authored
Actually fix package publishing (#5)
1 parent faff46a commit 6e0d338

2 files changed

Lines changed: 31 additions & 14 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
name: 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

813
jobs:
914
build:
@@ -38,17 +43,9 @@ jobs:
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
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
update_release_draft:
11+
permissions:
12+
contents: write
13+
pull-requests: read
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: release-drafter/release-drafter@v5
17+
with:
18+
disable-autolabeler: true
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)