Skip to content

Commit 4020a44

Browse files
vicperdanaCopilot
andcommitted
feat(release): dry-run trigger + PSDocs manifest URIs to monorepo
Phase 3 code-side work for the release-strategy. - Add workflow_dispatch trigger to all three release-*.yml workflows with two inputs: 'tag' (string, required) and 'dry_run' (boolean, default true). When dry_run=true the workflows still parse the tag, validate the manifest, extract CHANGELOG notes, and build the package, but skip Publish-Module / vsce publish / gh release create and instead print a summary step. Lets maintainers sanity-check a release end-to-end without producing any artifacts on PSGallery, the VS Marketplace, or GitHub Releases. - Replace 'github.ref_name' with 'inputs.tag || github.ref_name' so push and dispatch paths share one code path. - packages/psdocs/src/PSDocs/PSDocs.psd1: redirect ProjectUri, LicenseUri, and ReleaseNotes from microsoft/PSDocs to the new monorepo (Azure/PSDocs.Azure/tree/main/packages/psdocs and the package's CHANGELOG). PSDocs.Azure.psd1 was already correct. - RELEASING.md: add a 'Pre-flight: dry-run' section that explains when and how to use the new dispatch trigger. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent aed79b7 commit 4020a44

5 files changed

Lines changed: 99 additions & 11 deletions

File tree

.github/workflows/release-psdocs-azure.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ on:
44
push:
55
tags:
66
- '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
718

819
permissions: {}
920

@@ -33,15 +44,17 @@ jobs:
3344
id: version
3445
shell: pwsh
3546
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', ''
3749
$base = ($full -split '-', 2)[0]
3850
$isPrerelease = $full.Contains('-')
3951
$channel = if ($isPrerelease) { 'preview' } else { 'stable' }
52+
"tag=$tagRef" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
4053
"full=$full" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
4154
"base=$base" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
4255
"channel=$channel" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
4356
"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"
4558
4659
- name: Validate version matches manifest
4760
shell: pwsh
@@ -70,18 +83,30 @@ jobs:
7083
Invoke-Build Build -File ./pipeline.build.ps1 -Build '${{ steps.version.outputs.full }}'
7184
7285
- name: Publish to PSGallery
86+
if: ${{ github.event_name != 'workflow_dispatch' || inputs.dry_run != true }}
7387
shell: pwsh
7488
env:
7589
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
7690
run: |
7791
Publish-Module -Path packages/psdocs-azure/out/modules/PSDocs.Azure -NuGetApiKey $env:PSGALLERY_API_KEY
7892
7993
- name: Create GitHub Release
94+
if: ${{ github.event_name != 'workflow_dispatch' || inputs.dry_run != true }}
8095
env:
8196
GH_TOKEN: ${{ github.token }}
8297
PRERELEASE_FLAG: ${{ steps.version.outputs.is_prerelease == 'true' && '--prerelease' || '' }}
8398
run: |
84-
gh release create "${{ github.ref_name }}" \
99+
gh release create "${{ steps.version.outputs.tag }}" \
85100
--title "PSDocs.Azure v${{ steps.version.outputs.full }}" \
86101
--notes-file ./release-notes.md \
87102
$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

.github/workflows/release-psdocs.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ on:
44
push:
55
tags:
66
- 'psdocs-v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to simulate (e.g. psdocs-v0.10.0 or psdocs-v0.10.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
718

819
permissions: {}
920

@@ -33,15 +44,17 @@ jobs:
3344
id: version
3445
shell: pwsh
3546
run: |
36-
$full = '${{ github.ref_name }}' -replace '^psdocs-v', ''
47+
$tagRef = if ('${{ github.event_name }}' -eq 'workflow_dispatch') { '${{ inputs.tag }}' } else { '${{ github.ref_name }}' }
48+
$full = $tagRef -replace '^psdocs-v', ''
3749
$base = ($full -split '-', 2)[0]
3850
$isPrerelease = $full.Contains('-')
3951
$channel = if ($isPrerelease) { 'preview' } else { 'stable' }
52+
"tag=$tagRef" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
4053
"full=$full" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
4154
"base=$base" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
4255
"channel=$channel" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
4356
"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"
4558
4659
- name: Validate version matches manifest
4760
shell: pwsh
@@ -71,18 +84,30 @@ jobs:
7184
Invoke-Build Build -File ./pipeline.build.ps1 -Build '${{ steps.version.outputs.full }}'
7285
7386
- name: Publish to PSGallery
87+
if: ${{ github.event_name != 'workflow_dispatch' || inputs.dry_run != true }}
7488
shell: pwsh
7589
env:
7690
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
7791
run: |
7892
Publish-Module -Path packages/psdocs/out/modules/PSDocs -NuGetApiKey $env:PSGALLERY_API_KEY
7993
8094
- name: Create GitHub Release
95+
if: ${{ github.event_name != 'workflow_dispatch' || inputs.dry_run != true }}
8196
env:
8297
GH_TOKEN: ${{ github.token }}
8398
PRERELEASE_FLAG: ${{ steps.version.outputs.is_prerelease == 'true' && '--prerelease' || '' }}
8499
run: |
85-
gh release create "${{ github.ref_name }}" \
100+
gh release create "${{ steps.version.outputs.tag }}" \
86101
--title "PSDocs v${{ steps.version.outputs.full }}" \
87102
--notes-file ./release-notes.md \
88103
$PRERELEASE_FLAG
104+
105+
- name: Dry-run summary
106+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run == true }}
107+
shell: pwsh
108+
run: |
109+
Write-Host '=== DRY RUN ==='
110+
Write-Host "Would publish PSDocs v${{ steps.version.outputs.full }} (channel=${{ steps.version.outputs.channel }}) to PSGallery."
111+
Write-Host "Would create GitHub Release for tag ${{ steps.version.outputs.tag }}."
112+
Write-Host '--- release notes ---'
113+
Get-Content ./release-notes.md

.github/workflows/release-vscode.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ on:
1313
tags:
1414
- 'vscode-v*'
1515
- 'vscode-preview-v*'
16+
workflow_dispatch:
17+
inputs:
18+
tag:
19+
description: 'Tag to simulate (e.g. vscode-v0.4.0 or vscode-preview-v0.4.0)'
20+
required: true
21+
type: string
22+
dry_run:
23+
description: 'Skip vsce publish and gh release create (validate + build only).'
24+
required: false
25+
type: boolean
26+
default: true
1627

1728
permissions:
1829
contents: write
@@ -44,7 +55,7 @@ jobs:
4455
id: version
4556
shell: pwsh
4657
run: |
47-
$tag = '${{ github.ref_name }}'
58+
$tag = if ('${{ github.event_name }}' -eq 'workflow_dispatch') { '${{ inputs.tag }}' } else { '${{ github.ref_name }}' }
4859
if ($tag -match '^vscode-preview-v(.+)$') {
4960
$version = $Matches[1]
5061
$channel = 'preview'
@@ -61,6 +72,7 @@ jobs:
6172
Write-Error "Version '$version' must be plain SemVer (X.Y.Z) — VS Code Marketplace does not accept prerelease suffixes."
6273
exit 1
6374
}
75+
"tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
6476
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
6577
"channel=$channel" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
6678
"is_prerelease=$($isPrerelease.ToString().ToLower())" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
@@ -109,6 +121,7 @@ jobs:
109121
echo "Found VSIX: $VSIX_FILE"
110122
111123
- name: Publish to VS Marketplace
124+
if: ${{ github.event_name != 'workflow_dispatch' || inputs.dry_run != true }}
112125
working-directory: packages/vscode-extension/out/package
113126
env:
114127
VSCE_PAT: ${{ secrets.VSCE_PAT }}
@@ -117,13 +130,24 @@ jobs:
117130
npx @vscode/vsce publish --packagePath "${{ steps.vsix.outputs.file }}" --pat "$VSCE_PAT" $PRE_RELEASE_FLAG
118131
119132
- name: Create GitHub Release
133+
if: ${{ github.event_name != 'workflow_dispatch' || inputs.dry_run != true }}
120134
env:
121135
GH_TOKEN: ${{ github.token }}
122136
PRERELEASE_FLAG: ${{ steps.version.outputs.is_prerelease == 'true' && '--prerelease' || '' }}
123137
TITLE_SUFFIX: ${{ steps.version.outputs.is_prerelease == 'true' && ' (Preview)' || '' }}
124138
run: |
125-
gh release create "${{ github.ref_name }}" \
139+
gh release create "${{ steps.version.outputs.tag }}" \
126140
--title "VS Code Extension v${{ steps.version.outputs.version }}$TITLE_SUFFIX" \
127141
--notes-file ./release-notes.md \
128142
$PRERELEASE_FLAG \
129143
"${{ steps.vsix.outputs.path }}"
144+
145+
- name: Dry-run summary
146+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run == true }}
147+
shell: pwsh
148+
run: |
149+
Write-Host '=== DRY RUN ==='
150+
Write-Host "Would publish VS Code extension v${{ steps.version.outputs.version }} (channel=${{ steps.version.outputs.channel }}) to VS Marketplace."
151+
Write-Host "Would create GitHub Release for tag ${{ steps.version.outputs.tag }} with VSIX ${{ steps.vsix.outputs.file }}."
152+
Write-Host '--- release notes ---'
153+
Get-Content ./release-notes.md

RELEASING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ attached.
5858
4. Confirm — both `PSGALLERY_API_KEY` and `VSCE_PAT` are accessible to jobs
5959
that target this environment.
6060

61+
## Pre-flight: dry-run via workflow_dispatch
62+
63+
Each release workflow accepts a manual trigger with two inputs:
64+
65+
- **tag** — the tag you intend to push (e.g. `psdocs-azure-v0.5.0` or `vscode-preview-v0.4.0`).
66+
- **dry_run** — defaults to `true`. When `true`, the workflow does *everything* except `Publish-Module` / `vsce publish` / `gh release create`. Use this to:
67+
- Confirm the manifest version matches the planned tag.
68+
- Confirm `scripts/extract-release-notes.ps1` finds and renders the right CHANGELOG section.
69+
- Confirm the build artifact is produced (and, for VS Code, that the VSIX is named correctly).
70+
71+
To run a dry-run: **Actions → Release {Package} → Run workflow → fill in `tag`, leave `dry_run` checked → Run**.
72+
73+
Always do a dry-run before pushing the real tag for first-of-its-kind cases (first release after a manifest restructure, first time after upgrading a build dep, etc.).
74+
6175
## Cutting a release
6276

6377
The same shape applies to all three packages. The differences are: which

packages/psdocs/src/PSDocs/PSDocs.psd1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,16 @@ PrivateData = @{
120120
Tags = @('Markdown', 'PSDocs', 'DevOps', 'CI')
121121

122122
# A URL to the license for this module.
123-
LicenseUri = 'https://github.com/Microsoft/PSDocs/blob/main/LICENSE'
123+
LicenseUri = 'https://github.com/Azure/PSDocs.Azure/blob/main/LICENSE'
124124

125125
# A URL to the main website for this project.
126-
ProjectUri = 'https://github.com/Microsoft/PSDocs'
126+
ProjectUri = 'https://github.com/Azure/PSDocs.Azure/tree/main/packages/psdocs'
127127

128128
# A URL to an icon representing this module.
129129
# IconUri = ''
130130

131131
# ReleaseNotes of this module
132-
ReleaseNotes = 'https://github.com/Microsoft/PSDocs/releases'
132+
ReleaseNotes = 'https://github.com/Azure/PSDocs.Azure/blob/main/packages/psdocs/CHANGELOG.md'
133133

134134
} # End of PSData hashtable
135135

0 commit comments

Comments
 (0)