Skip to content

Avoid tagging main with latest #107

Avoid tagging main with latest

Avoid tagging main with latest #107

Workflow file for this run

name: Deploy docs
on: # yamllint disable-line rule:truthy
push:
branches:
- main
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: |
pip install mkdocs mkdocs-material mike \
mkdocs-awesome-pages-plugin beautifulsoup4 lxml
- name: Copy all to docs folder
run: |
mkdir -p docs
shopt -s extglob
mv !(docs) docs/
- name: Deploy documentation
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
TAG=${{ github.ref_name }}
VERSION=$(echo ${TAG} | awk -F'.' '{print $1"."$2}')
fi
export BASE_URL=${BASE_URL}/${TAG:-main}
git fetch origin ${DOCS_BRANCH} --depth=1
mike deploy -F ${DOCS_CONFIG} \
--push --branch ${DOCS_BRANCH} \
--update-aliases ${VERSION:-main} ${VERSION:+latest}
mike set-default -F ${DOCS_CONFIG} \
--push --branch ${DOCS_BRANCH} latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_COMMITTER_NAME: ci-bot
GIT_COMMITTER_EMAIL: [email protected]
BASE_URL: https://github.com/SciCatProject/scicatlive/blob
DOCS_BRANCH: gh-pages
DOCS_CONFIG: .github/mkdocs.yaml