Skip to content

Commit 76961c8

Browse files
Copilotjaredpar
andauthored
Match complog publish pattern: workflow_run + workflow_dispatch triggers
Agent-Logs-Url: https://github.com/jaredpar/basic-reference-assemblies/sessions/3a3bd19d-3b24-4a5e-ad3a-9f28d7934700 Co-authored-by: jaredpar <146967+jaredpar@users.noreply.github.com>
1 parent 5fa9396 commit 76961c8

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

.github/workflows/publish.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
name: Publish NuGet Packages
22
on:
3-
push:
4-
branches: [ main ]
53
workflow_dispatch:
64
inputs:
75
version:
8-
description: 'Package Version (leave blank to auto-increment patch)'
9-
required: false
10-
type: string
6+
description: 'Package Version'
7+
required: true
118
default: ''
9+
workflow_run:
10+
workflows: ["Code Validation"]
11+
branches: [main]
12+
types: [completed]
1213

1314
jobs:
1415
publish:
1516
name: Publish NuGet
1617
runs-on: ubuntu-latest
18+
if: >-
19+
github.event_name == 'workflow_dispatch' ||
20+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
1721
steps:
1822
- uses: actions/checkout@v4
1923
with:
@@ -22,8 +26,8 @@ jobs:
2226
- name: Compute Next Version
2327
id: version
2428
run: |
25-
if [ -n "${{ github.event.inputs.version }}" ]; then
26-
next="${{ github.event.inputs.version }}"
29+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
30+
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
2731
else
2832
latest=$(git tag --list 'v*' --sort=-version:refname | head -n 1)
2933
if [ -z "$latest" ]; then
@@ -35,8 +39,8 @@ jobs:
3539
patch=$(echo "$version" | cut -d. -f3)
3640
next="${major}.${minor}.$((patch + 1))"
3741
fi
42+
echo "version=${next}" >> "$GITHUB_OUTPUT"
3843
fi
39-
echo "version=${next}" >> "$GITHUB_OUTPUT"
4044
4145
- name: Setup .NET
4246
uses: actions/setup-dotnet@v4

0 commit comments

Comments
 (0)