-
Notifications
You must be signed in to change notification settings - Fork 5
51 lines (44 loc) · 1.58 KB
/
gh-pages.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
name: github pages
on:
push:
branches:
- main # Set a branch to deploy
- release-*
pull_request:
repository_dispatch:
types: [rebuild-deploy]
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.112.3'
extended: true
- id: get-path
run: echo "path=v${GITHUB_REF_NAME#release-}" >> $GITHUB_OUTPUT
if: github.event_name == 'push' && github.ref_name != 'main'
- name: get branches
run: |
cat <<EOF > data/versions.yaml
versions:
$(gh api repos/:owner/:repo/branches --paginate | jq -r '.[] | select(.name | startswith("release-")) | .name' | sed 's/release-/ - /')
EOF
env:
GH_TOKEN: ${{ github.token }}
- name: Build
run: hugo --minify --baseURL https://docs.diambra.ai/${{ github.ref_name == 'main' && '' || steps.get-path.outputs.path }}
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'push' || github.event_name == 'repository_dispatch'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
cname: docs.diambra.ai
keep_files: ${{ github.ref_name == 'main' }}
destination_dir: ${{ github.ref_name == 'main' && '' || steps.get-path.outputs.path }}