Merge pull request #652 from airtai/dev #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Docs | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- docs/** | |
- .github/workflows/deploy-docs.yaml | |
- fastagency/__about__.py | |
permissions: | |
contents: write | |
jobs: | |
deploy_docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- uses: actions/cache@v4 | |
with: | |
key: ${{ github.ref }} | |
path: .cache | |
- run: pip install -e ".[dev]" | |
- run: ./scripts/build-docs.sh | |
- run: echo "VERSION=$(python3 -c 'from importlib.metadata import version; print(".".join(version("fastagency").split(".")[:2]))')" >> $GITHUB_ENV | |
- run: echo "IS_RC=$(python3 -c 'from importlib.metadata import version; print("rc" in version("fastagency"))')" >> $GITHUB_ENV | |
- name: Configure Git user | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- run: echo $VERSION | |
- run: echo $IS_RC | |
- run: | | |
if [ "$IS_RC" == "False" ]; then | |
cd docs && mike deploy -F mkdocs.yml --update-aliases $VERSION latest | |
mike set-default --push --allow-empty -F mkdocs.yml latest | |
else | |
cd docs && mike deploy --push -F mkdocs.yml --update-aliases $VERSION | |
fi |