diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 639ccfe4..13bb9297 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -218,6 +218,40 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml + Deploy-Pages: + permissions: + contents: write + runs-on: ubuntu-latest + needs: + - Static-Check + - Run-Unit-Tests + - Run-Integration-Tests + 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-integrations-bot" + git config user.email "oss-integrations-bot@astronomer.io" + + 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 + Publish-Package: if: github.event_name == 'release' name: Build and publish Python 🐍 distributions 📦 to PyPI diff --git a/docs/contributing/howto.md b/docs/contributing/howto.md index 1edda9d7..cecc77a0 100644 --- a/docs/contributing/howto.md +++ b/docs/contributing/howto.md @@ -19,7 +19,7 @@ This document describes how to contribute to DAG Factory, covering: To contribute to the DAG Factory project: -1. Please create a [GitHub Issue](https://github.com/astronomer/dag-factory/issues) describing a bug, enhancement, or feature request. +1. Please create a [GitHub Issue](https://github.com/astronomer/dag-factory/issues) describing a bug, enhancement, or feature request. 2. Open a branch off of the `main` branch and create a Pull Request into the `main` branch from your feature branch. 3. Link your issue to the pull request. 4. After you complete development on your feature branch, request a review. A maintainer will merge your PR after all reviewers approve it. @@ -28,9 +28,9 @@ To contribute to the DAG Factory project: ### Requirements -* [Git](https://git-scm.com/) -* [Python](https://www.python.org/) <= 3.12 (due to dependencies, such as ``google-re2`` not supporting Python 3.13 yet) -* [Hatch](https://hatch.pypa.io/latest/) +- [Git](https://git-scm.com/) +- [Python](https://www.python.org/) <= 3.12 (due to dependencies, such as ``google-re2`` not supporting Python 3.13 yet) +- [Hatch](https://hatch.pypa.io/latest/) Clone the **DAG Factory** repository and change the current working directory to the repo's root directory: @@ -41,22 +41,22 @@ cd dag-factory/ After cloning the project, there are two options for setting up the local development environment: -* Use a Python virtual environment, or -* Use Docker +- Use a Python virtual environment, or +- Use Docker ### Using a Python virtual environment for local development 1. Install the project dependencies: -```bash -make setup -``` + ```bash + make setup + ``` 2. Activate the local python environment: -```bash -source venv/bin/activate -``` + ```bash + source venv/bin/activate + ``` 3. Set [Apache Airflow®](https://airflow.apache.org/) home to the ``dev/``, so you can see DAG Factory example DAGs. Disable loading Airflow standard example DAGs: @@ -160,22 +160,16 @@ We use Markdown to author DAG Factory documentation. Similar to running tests, we also use hatch to manage the documentation. -To build the documentation locally: - -```bash -hatch run docs:build -``` - -To serve the documentation locally in `localhost:8080`: +To build and serve the documentation locally: ```bash -hatch run docs:serve +hatch run docs:dev ``` To release the documentation with the current project version and set it to the latest: ```bash -hatch run docs:release +hatch run docs:gh-release ``` ## Releasing diff --git a/pyproject.toml b/pyproject.toml index d6a32a3d..e4c39748 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -115,9 +115,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