ci: deploy docs on forks if they have pages enabled

This commit is contained in:
ThinkChaos 2023-05-11 21:34:10 -04:00
parent 8a93e4500c
commit 2bd59484c0
1 changed files with 12 additions and 10 deletions

View File

@ -2,17 +2,18 @@ name: docs
on: on:
push: push:
branches: branches:
- main - '**'
tags: tags:
- v* - v*
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository_owner == '0xERR0R' if: ${{ github.event.repository.has_pages && (github.repository_owner != '0xERR0R' || github.ref_type == 'tag' || github.ref_name == 'main') }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:
python-version: 3.x python-version: 3.x
@ -25,9 +26,10 @@ jobs:
git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]" git config --local user.name "github-actions[bot]"
- name: Deploy version for tag/branch - name: Deploy version for branch
run: mike deploy --push --update-aliases ${GITHUB_REF_NAME} if: ${{ startsWith(github.ref, 'refs/heads/') }}
- name: Deploy latest version for tag only run: mike deploy --push --update-aliases "$(sed 's:/:-:g' <<< "${GITHUB_REF_NAME}")"
if: ${{ github.ref != 'refs/heads/main' }}
run: mike deploy --push --update-aliases ${GITHUB_REF_NAME} latest - name: Deploy version for tag and update latest
- run: mike set-default --push latest if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: mike deploy --push --update-aliases "${GITHUB_REF_NAME}" latest