-
Notifications
You must be signed in to change notification settings - Fork 123
80 lines (69 loc) · 2.2 KB
/
Copy pathdeploy-github-pages.yml
File metadata and controls
80 lines (69 loc) · 2.2 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
name: Deployment to GitHub Pages
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'site/**'
- 'docs/**'
- '.github/workflows/deploy-github-pages.yml'
pull_request:
paths:
- 'site/**'
- 'docs/**'
- '.github/workflows/deploy-github-pages.yml'
permissions:
contents: read
env:
REPO_NAME: ${{ github.event.repository.name }}
REPO_OWNER: ${{ github.repository_owner }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
submodules: recursive # Fetch any git submodules if configured
persist-credentials: false
- name: Setup Hugo
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
with:
hugo-version: '0.136.5' # Matching local Hugo version
extended: true
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: '20'
check-latest: true
- name: Install PostCSS dependencies
run: |
npm init --yes
npm install --save-dev autoprefixer postcss-cli postcss
working-directory: ./site
- name: Build Hugo Site
run: hugo --baseURL https://sam-mesh.dev --minify
working-directory: ./site
- name: Create CNAME
run: echo "sam-mesh.dev" > ./site/public/CNAME
- name: Upload artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: ./site/public
deploy:
needs: build
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1