Skip to content

Convert and publish #14

Convert and publish

Convert and publish #14

# Convert all Windows protocol specs to markdown, build a clean publish tree,
# then force-push it to an orphaned 'publish' branch (e.g. for GitHub Pages).
# Conversion runs in parallel (PowerShell 7) to reduce run time.
name: Convert and publish
on:
workflow_dispatch:
# Required for force-pushing to the orphaned 'publish' branch.
permissions:
contents: write
jobs:
convert-and-publish:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install OpenXML module
shell: pwsh
run: |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name OpenXML -Force -Scope CurrentUser
- name: Build publish tree and Windows_Protocols.zip
shell: pwsh
working-directory: ${{ github.workspace }}
run: .\scripts\Build-Publish.ps1
- name: Upload publish artifact
uses: actions/upload-artifact@v4
with:
name: publish
path: Windows_Protocols.zip
- name: Push to orphaned publish branch
shell: pwsh
working-directory: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$RemoteRepo = "https://${Env:GITHUB_ACTOR}:${Env:GITHUB_TOKEN}@github.com/${Env:GITHUB_REPOSITORY}.git"
git init
git config user.name "GitHub Actions"
git config user.email "github-actions-bot@users.noreply.github.com"
git add .
git commit -m "Publish converted Open Specs markdown (${Env:GITHUB_REPOSITORY})"
git push --force "${RemoteRepo}" "HEAD:publish"