Skip to content

rebuild-deploy

rebuild-deploy #189

Workflow file for this run

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 }}