Skip to content

Commit

Permalink
Add GH action job to deploy docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajastro committed Jan 8, 2025
1 parent c181a5f commit fef4069
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI Docs

on:
push: # Run on pushes to the default branch
branches: [main, docs_job]
pull_request_target: # Also run on pull requests originated from forks
branches: [main, docs_job]
release:
types: ['published']

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:

Deploy-Pages:
permissions:
contents: write
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- uses: actions/setup-python@v5
with:
python-version: "3.12"
architecture: "x64"

- name: Install packages and dependencies
run: pip install hatch

- name: Deploy Docs
run: |
git config user.name "OSS Integration Bot"
git config user.email "[email protected]"
git fetch origin gh-pages --depth=1
if [[ $GITHUB_EVENT_NAME == "release" && $GITHUB_EVENT_ACTION == "published" ]]; then
hatch run docs:gh-release
else
hatch run docs:gh-deploy
fi
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ dependencies = [
]

[tool.hatch.envs.docs.scripts]
build = "mike deploy --push dev"
serve = "mike serve"
release = "version=$(python -W ignore -c 'import dagfactory; print(dagfactory.__version__)') && mike deploy --push --update-aliases $version latest"
dev = "mkdocs build && mkdocs serve" # For local development and preventing publishing
gh-deploy = "mike deploy --push dev"
gh-release = "version=$(python -W ignore -c 'import dagfactory; print(dagfactory.__version__)') && mike deploy --push --update-aliases $version latest"

######################################
# THIRD PARTY TOOLS
Expand Down

0 comments on commit fef4069

Please sign in to comment.