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 6, 2025
1 parent 61eaf07 commit d620045
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI jobs

on:
push: # Run on pushes to the default branch
branches: [main]
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-Docs:
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:
run: |
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 d620045

Please sign in to comment.