|
4 | 4 | push: |
5 | 5 | tags: |
6 | 6 | - 'psdocs-azure-v*' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag: |
| 10 | + description: 'Tag to simulate (e.g. psdocs-azure-v0.5.0 or psdocs-azure-v0.5.0-preview.1)' |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + dry_run: |
| 14 | + description: 'Skip Publish-Module and gh release create (validate + build only).' |
| 15 | + required: false |
| 16 | + type: boolean |
| 17 | + default: true |
7 | 18 |
|
8 | 19 | permissions: {} |
9 | 20 |
|
@@ -33,15 +44,17 @@ jobs: |
33 | 44 | id: version |
34 | 45 | shell: pwsh |
35 | 46 | run: | |
36 | | - $full = '${{ github.ref_name }}' -replace '^psdocs-azure-v', '' |
| 47 | + $tagRef = if ('${{ github.event_name }}' -eq 'workflow_dispatch') { '${{ inputs.tag }}' } else { '${{ github.ref_name }}' } |
| 48 | + $full = $tagRef -replace '^psdocs-azure-v', '' |
37 | 49 | $base = ($full -split '-', 2)[0] |
38 | 50 | $isPrerelease = $full.Contains('-') |
39 | 51 | $channel = if ($isPrerelease) { 'preview' } else { 'stable' } |
| 52 | + "tag=$tagRef" | Out-File -FilePath $env:GITHUB_OUTPUT -Append |
40 | 53 | "full=$full" | Out-File -FilePath $env:GITHUB_OUTPUT -Append |
41 | 54 | "base=$base" | Out-File -FilePath $env:GITHUB_OUTPUT -Append |
42 | 55 | "channel=$channel" | Out-File -FilePath $env:GITHUB_OUTPUT -Append |
43 | 56 | "is_prerelease=$($isPrerelease.ToString().ToLower())" | Out-File -FilePath $env:GITHUB_OUTPUT -Append |
44 | | - Write-Host "Tag: ${{ github.ref_name }} -> full=$full base=$base channel=$channel" |
| 57 | + Write-Host "Tag: $tagRef -> full=$full base=$base channel=$channel" |
45 | 58 |
|
46 | 59 | - name: Validate version matches manifest |
47 | 60 | shell: pwsh |
@@ -70,18 +83,30 @@ jobs: |
70 | 83 | Invoke-Build Build -File ./pipeline.build.ps1 -Build '${{ steps.version.outputs.full }}' |
71 | 84 | |
72 | 85 | - name: Publish to PSGallery |
| 86 | + if: ${{ github.event_name != 'workflow_dispatch' || inputs.dry_run != true }} |
73 | 87 | shell: pwsh |
74 | 88 | env: |
75 | 89 | PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }} |
76 | 90 | run: | |
77 | 91 | Publish-Module -Path packages/psdocs-azure/out/modules/PSDocs.Azure -NuGetApiKey $env:PSGALLERY_API_KEY |
78 | 92 | |
79 | 93 | - name: Create GitHub Release |
| 94 | + if: ${{ github.event_name != 'workflow_dispatch' || inputs.dry_run != true }} |
80 | 95 | env: |
81 | 96 | GH_TOKEN: ${{ github.token }} |
82 | 97 | PRERELEASE_FLAG: ${{ steps.version.outputs.is_prerelease == 'true' && '--prerelease' || '' }} |
83 | 98 | run: | |
84 | | - gh release create "${{ github.ref_name }}" \ |
| 99 | + gh release create "${{ steps.version.outputs.tag }}" \ |
85 | 100 | --title "PSDocs.Azure v${{ steps.version.outputs.full }}" \ |
86 | 101 | --notes-file ./release-notes.md \ |
87 | 102 | $PRERELEASE_FLAG |
| 103 | +
|
| 104 | + - name: Dry-run summary |
| 105 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run == true }} |
| 106 | + shell: pwsh |
| 107 | + run: | |
| 108 | + Write-Host '=== DRY RUN ===' |
| 109 | + Write-Host "Would publish PSDocs.Azure v${{ steps.version.outputs.full }} (channel=${{ steps.version.outputs.channel }}) to PSGallery." |
| 110 | + Write-Host "Would create GitHub Release for tag ${{ steps.version.outputs.tag }}." |
| 111 | + Write-Host '--- release notes ---' |
| 112 | + Get-Content ./release-notes.md |
0 commit comments