Merge pull request #156 from sdwheeler/sdw-Metadata-HelpInfoUri #425
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 Site | |
on: | |
push: | |
branches: | |
- main # Set a branch that will trigger a deployment | |
pull_request: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: 'latest' | |
extended: true | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
cache: npm | |
# The action defaults to search for the dependency file (package-lock.json, | |
# npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its | |
# hash as a part of the cache key. | |
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data | |
cache-dependency-path: '**/package-lock.json' | |
- name: Install PostCSS | |
run: | | |
cd ./Site | |
npm ci | |
npm ls | |
cd .. | |
- name: Setup PowerShell module cache | |
id: cacher | |
uses: actions/cache@v4 | |
with: | |
path: '~/.local/share/powershell/Modules' | |
key: ${{ runner.os }}-SqlServer-PSScriptAnalyzer | |
- name: Install required PowerShell modules | |
if: steps.cacher.outputs.cache-hit != 'true' | |
shell: pwsh | |
run: | | |
Set-PSRepository PSGallery -InstallationPolicy Trusted | |
Install-Module InvokeBuild, PowerShell-Yaml -ErrorAction Stop | |
- name: Build the Site | |
shell: pwsh | |
env: | |
HUGO_ENVIRONMENT: production | |
HUGO_ENV: production | |
run: | | |
Invoke-Build -Task BuildSite -SiteBaseUrl https://microsoft.github.io/Documentarian/ | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./Site/public | |
# Deployment job | |
deploy: | |
if: github.ref == 'refs/heads/main' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |