-
Notifications
You must be signed in to change notification settings - Fork 10
86 lines (82 loc) · 2.53 KB
/
publish.site.yml
File metadata and controls
86 lines (82 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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@v5
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Setup Hugo
id: hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: latest
extended: true
# - name: Setup Node
# uses: actions/setup-node@v3
# 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 }}-dsc-samples
- 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 "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
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