-
Notifications
You must be signed in to change notification settings - Fork 4
52 lines (44 loc) · 1.32 KB
/
hugo_build_deploy_website.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
name: hugo-build-deploy-on-push
on:
# Runs on pushes targeting the default branch
push:
branches: ["main", "release-v**"]
paths:
- website/**
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
jobs:
# Build job
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 0.105.0
extended: true
- name: Extract branch name
shell: bash
run: echo "VERSION_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/release//;s/-//' | sed 's/main/dev/' | sed 's/v1.8/./')" >> $GITHUB_OUTPUT
id: extract_branch
- name: Run a multi-line script
run: |
cd $GITHUB_WORKSPACE/website
npm install [email protected]
hugo
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./website/public
destination_dir: ${{ steps.extract_branch.outputs.version_name }}
keep_files: true