-
Notifications
You must be signed in to change notification settings - Fork 49
65 lines (54 loc) · 1.51 KB
/
deploy-prod.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
name: Deploy Prod to gh pages
on:
push:
branches:
- main
workflow_dispatch: {}
jobs:
deploy-prod:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Checkout build environment
uses: actions/checkout@v4
with:
ref: main
path: build-environment
- uses: actions/[email protected]
with:
node-version: 22
check-latest: true
- name: Get Hugo Version
id: hugo-version
run: |
version=$(jq -r .hugo "build-environment/scripts/.util/tools.json")
echo "version=${version#v}" >> "$GITHUB_OUTPUT"
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: ${{ steps.hugo-version.outputs.version }}
extended: true
- name: Build
run: cd build-environment && npm install && hugo
- name: Update
run: |
git rm -r --ignore-unmatch .
cp -a build-environment/public/* .
rm -rf build-environment
- name: Commit
id: commit
run: |
git config --global user.email "[email protected]"
git config --global user.name "paketo-bot"
if [[ -n "$(git status --short)" ]]; then
git add --all .
git commit --message "Deploying"
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
fi
- name: Push
if: ${{ steps.commit.outputs.commit_sha != '' }}
run: git push origin gh-pages