|
5 | 5 | branches: [ main, master ] |
6 | 6 | pull_request: |
7 | 7 | branches: [ main, master ] |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + force_build: |
| 11 | + description: 'Force build even if version unchanged' |
| 12 | + required: false |
| 13 | + default: 'false' |
| 14 | + type: boolean |
8 | 15 |
|
9 | 16 | permissions: |
10 | 17 | contents: write |
@@ -89,17 +96,30 @@ jobs: |
89 | 96 | $currentVersion = "${{ steps.version.outputs.VERSION }}" |
90 | 97 | $previousVersion = "${{ steps.previous_version.outputs.PREVIOUS_VERSION }}" |
91 | 98 |
|
| 99 | + $isManualTrigger = "${{ github.event_name }}" -eq "workflow_dispatch" |
| 100 | + $forceBuild = "${{ github.event.inputs.force_build }}" -eq "true" |
| 101 | +
|
92 | 102 | if ([string]::IsNullOrEmpty($previousVersion)) { |
93 | | - echo "No previous version found - skipping build (no version change to compare)" |
94 | | - echo "SHOULD_BUILD=false" >> $env:GITHUB_OUTPUT |
95 | | - echo "::notice::Skipping build - no previous version to compare against. To force a build, bump the version number." |
96 | | - exit 0 |
| 103 | + if ($isManualTrigger -or $forceBuild) { |
| 104 | + echo "No previous version found - proceeding with build (manual trigger or force build)" |
| 105 | + echo "SHOULD_BUILD=true" >> $env:GITHUB_OUTPUT |
| 106 | + } else { |
| 107 | + echo "No previous version found - skipping build (no version change to compare)" |
| 108 | + echo "SHOULD_BUILD=false" >> $env:GITHUB_OUTPUT |
| 109 | + echo "::notice::Skipping build - no previous version to compare against. To force a build, bump the version number or trigger manually." |
| 110 | + exit 0 |
| 111 | + } |
97 | 112 | } |
98 | 113 |
|
99 | 114 | if ($currentVersion -eq $previousVersion) { |
100 | | - echo "Version unchanged ($currentVersion), skipping build" |
101 | | - echo "SHOULD_BUILD=false" >> $env:GITHUB_OUTPUT |
102 | | - echo "::notice::Skipping build - no version change detected (current: $currentVersion, previous: $previousVersion)" |
| 115 | + if ($isManualTrigger -or $forceBuild) { |
| 116 | + echo "Version unchanged ($currentVersion), but proceeding with build (manual trigger or force build)" |
| 117 | + echo "SHOULD_BUILD=true" >> $env:GITHUB_OUTPUT |
| 118 | + } else { |
| 119 | + echo "Version unchanged ($currentVersion), skipping build" |
| 120 | + echo "SHOULD_BUILD=false" >> $env:GITHUB_OUTPUT |
| 121 | + echo "::notice::Skipping build - no version change detected (current: $currentVersion, previous: $previousVersion)" |
| 122 | + } |
103 | 123 | } else { |
104 | 124 | echo "Version changed from $previousVersion to $currentVersion, proceeding with build" |
105 | 125 | echo "SHOULD_BUILD=true" >> $env:GITHUB_OUTPUT |
|
0 commit comments