Skip to content

Commit 1b7f877

Browse files
authored
chore(docs): auto-trigger new feature docs version via release pipeline (#456)
* chore(docs): auto-trigger new feature docs version via release pipeline * fix(gh): correct gh token * Update build/templates/trigger-bump-docs-version.yml * Update trigger-bump-docs-version.yml
1 parent 4e6023c commit 1b7f877

3 files changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Bump new docs version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Specify the new version to bump (e.g. v1.1.0)'
8+
required: true
9+
10+
jobs:
11+
generate-new-version:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Generate new version
21+
run: |
22+
cd docs
23+
npm install
24+
npm run docusaurus docs:version ${{ github.event.inputs.version }}
25+
26+
- name: Check for changes
27+
run: |
28+
if git diff --quiet; then
29+
echo "No changes detected."
30+
exit 0
31+
fi
32+
33+
- name: Configure Git
34+
run: |
35+
git config --global user.name "github-actions[bot]"
36+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
37+
38+
- name: Create Pull Request
39+
uses: peter-evans/create-pull-request@v6
40+
with:
41+
branch: "docs(${{ github.event.inputs.version }})/bump-docs-version"
42+
title: "docs(${{ github.event.inputs.version }}): bump new docs version"
43+
body: "This automatically generated PR bumps the docs version to ${{ github.event.inputs.version }}."
44+
commit-message: "docs(${{ github.event.inputs.version }}): bump new docs version"
45+
delete-branch: true

build/psgallery-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ resources:
5656
endpoint: arcus-azure
5757

5858
variables:
59+
- group: 'GitHub Configuration'
5960
- group: 'Build Configuration'
6061
- group: 'Arcus Scripting - Integration Testing'
6162
- group: 'Arcus.Scripting - Releasing PS Gallery'
@@ -205,3 +206,6 @@ stages:
205206
displayName: 'Push to PowerShell Gallery'
206207
env:
207208
ARTIFACT_DIR: '$(Build.ArtifactStagingDirectory)'
209+
- template: templates/trigger-bump-docs-version.yml
210+
parameters:
211+
gitHubToken: $(GITHUB_TOKEN)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
parameters:
2+
gitHubToken: ''
3+
4+
steps:
5+
- script: sudo apt install gh
6+
displayName: 'Install GitHub CLI'
7+
- powershell: |
8+
gh auth login --with-token $(GITHUB_TOKEN)
9+
gh repo view
10+
11+
if ($env:VERSION -notmatch '-' -and $env:VERSION -match '^v[0-9]+\.[0-9]+\.0$') {
12+
gh workflow run bump-docs-version.yml `
13+
--repo arcus-azure/arcus.testing `
14+
--ref main `
15+
--field version=$env:VERSION
16+
}
17+
displayName: 'Trigger new feature docs version PR'
18+
env:
19+
VERSION: v$(Build.BuildNumber)

0 commit comments

Comments
 (0)