Skip to content

Commit

Permalink
Update gh-pages.yml to support versioned docs
Browse files Browse the repository at this point in the history
Update gh-pages.yml to support versioned docs
  • Loading branch information
himanishk committed May 20, 2023
1 parent 4bd2135 commit 87ae9ee
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ name: Publish Github Pages
on:
push:
branches:
- master
- dev
release:
types:
- created

defaults:
run:
working-directory: ./docs

jobs:
deploy:
runs-on: ubuntu-20.04
Expand All @@ -27,10 +32,22 @@ jobs:
- name: Build
run: hugo --minify

- name: Deploy
- name: Fetch Latest Release Version
id: get_latest_release
if: github.event_name == 'release'
run: |
echo "::set-output name=release::${{ github.event.release.tag_name }}"
- name: Fetch Last Available Release Version
id: get_last_release
if: github.event_name == 'push' || !steps.get_latest_release.outputs.release
run: |
echo "::set-output name=release::$(git describe --tags --abbrev=0)"
- name: Deploy Documentation - Versioned
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/master' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/public
publish_branch: public_docs
publish_branch: public_docs
destination_dir: ${{ steps.get_last_release.outputs.release }}

0 comments on commit 87ae9ee

Please sign in to comment.