Skip to content

Commit

Permalink
Use mike to deploy to Github Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
sindrehan committed Sep 22, 2023
1 parent 85fed88 commit 83bc7e7
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Build and deploy documentation

on: [push]
on:
push:
tags-ignore:
- "*"
branches:
- "*"
release:
types: [released]

jobs:
DeployDocumentation:
Expand Down Expand Up @@ -30,12 +37,29 @@ jobs:
with:
name: docs
path: site

- name: Deploy documentation
uses: JamesIves/[email protected]
- name: Setup git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Fetch gh-pages
run: git fetch origin gh-pages --depth=1
- name: Set variables
run: |
full_version="v$(cut -d ' ' -f 2 <<< "$(poetry version)")"
major_minor="$(cut -d '.' -f 1 <<< "$full_version")"."$(cut -d '.' -f 2 <<< "$full_version")"
echo "full_version=$full_version" >> $GITHUB_ENV
echo "major_minor=$major_minor" >> $GITHUB_ENV
- name: Deploy master
if: github.ref == 'refs/heads/master'
run: |
poetry run mike deploy dev
- name: Deploy release
if: ${{ github.event_name == 'release' }}
run: |
poetry run mike deploy --title ${{ env.full_version }} --update-aliases ${{ env.major_minor }} latest
- name: Push to gh-pages
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GIT_TOKEN }}
branch: gh-pages
folder: site
env:
ACCESS_TOKEN: ${{ secrets.GIT_TOKEN }}
if: github.ref == 'refs/heads/master'

0 comments on commit 83bc7e7

Please sign in to comment.