Publish Website #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Website | |
on: | |
push: | |
paths: | |
- 'SnowSite/**' | |
- '.github/workflows/publish-website.yml' | |
workflow_dispatch: | |
workflow_run: | |
workflows: ["Build Snow"] | |
types: | |
- completed | |
jobs: | |
publish: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout SnowSite | |
uses: actions/checkout@v3 | |
with: | |
sparse-checkout: SnowSite | |
path: .\doc | |
- name: Checkout Website | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ secrets.WEBSITE_REPO }} | |
path: .\website | |
token: ${{ secrets.WEBSITE_PAT }} | |
- name: Download Snow artifact | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: build-snow.yml | |
- name: run Snow | |
shell: pwsh | |
run: | | |
$ErrorActionPreference = 'Stop' | |
$blogdir = ".\website" | |
$docdir = ".\doc\SnowSite" | |
"Configuring git..." | |
pushd $docdir | |
$lastMessage = git log -1 --pretty=%B | Select-Object -First 1 | |
$lastUserName = git log -1 --pretty=format:'%an' | Select-Object -First 1 | |
$lastUserEamil = git log -1 --pretty=format:'%ae' | Select-Object -First 1 | |
git config --global user.name "github actions bot (on behalf of $lastUserName)" | |
git config --global user.email $lastUserEamil | |
git config --global core.autocrlf false | |
popd | |
"Running Snow..." | |
& Snow\Snow.exe "config=$docdir\Snow\Snow.config.json" | |
Write-Output "Updating $blogdir..." | |
cd $blogdir | |
git add . | |
git commit -m "Publish: $lastMessage" | |
git push |