Skip to content

Commit

Permalink
ci: deploy docs on forks if they have pages enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ThinkChaos committed Jul 7, 2023
1 parent 8a93e45 commit 2bd5948
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,34 @@ name: docs
on:
push:
branches:
- main
- '**'
tags:
- v*
jobs:
deploy:
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:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: 3.x

- name: install tools
run: pip install mkdocs-material mike

- name: Setup doc deploy
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Deploy version for tag/branch
run: mike deploy --push --update-aliases ${GITHUB_REF_NAME}
- name: Deploy latest version for tag only
if: ${{ github.ref != 'refs/heads/main' }}
run: mike deploy --push --update-aliases ${GITHUB_REF_NAME} latest
- run: mike set-default --push latest
- name: Deploy version for branch
if: ${{ startsWith(github.ref, 'refs/heads/') }}
run: mike deploy --push --update-aliases "$(sed 's:/:-:g' <<< "${GITHUB_REF_NAME}")"

- name: Deploy version for tag and update latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: mike deploy --push --update-aliases "${GITHUB_REF_NAME}" latest

0 comments on commit 2bd5948

Please sign in to comment.