-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (72 loc) · 1.94 KB
/
publish.yml
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
87
name: Publish Hugo Site
on:
push:
branches:
- main
paths-ignore:
- templates/**
workflow_run:
workflows: ["Update Projects Page"]
types:
- completed
jobs:
update_hugo_npm_dependencies:
name: Update Hugo npm Dependencies
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
commit_hash: ${{ steps.commit_changes.outputs.commit_hash }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.111.3"
extended: true
- name: Write composite package.json
run: hugo mod npm pack
- name: Install npm Packages
run: npm install
- name: Display Changes
run: git status
- name: Commit Changes
id: commit_changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update Hugo npm Dependencies
publish:
name: Publish Hugo Site
needs: update_hugo_npm_dependencies
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.update_hugo_npm_dependencies.outputs.commit_hash }}
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.111.3"
extended: true
- name: Install npm Packages
run: npm ci
- name: Build Hugo
run: hugo --minify
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public