diff --git a/.github/workflows/mike-deploy.yml b/.github/workflows/mike-deploy.yml new file mode 100644 index 000000000..9a413c252 --- /dev/null +++ b/.github/workflows/mike-deploy.yml @@ -0,0 +1,90 @@ +# Workflow inspiration and adaptation came from Andruino-Cli +# https://github.com/arduino/arduino-cli/blob/master/.github/workflows/deploy-cobra-mkdocs-versioned-poetry.yml + +name: Deploy Documents 5.5 + +env: + PYTHON_VERSION: "3.9" + +on: + push: + branches: + # Branch to base "dev" website on. + - main + # Release branches have names like 0.8.x, 0.9.x, ... + - "[0-9]+.[0-9]+.x" + create: + +jobs: + pre-publish: + runs-on: ubuntu-latest + outputs: + result: ${{ steps.determination.outputs.result }} + steps: + - name: Determine if documentation should be published on this workflow run + id: determination + run: | + RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" + if [[ "${{ github.event_name }}" == "push" || ( "${{ github.event_name }}" == "create" && "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX ) ]]; then + RESULT="true" + else + RESULT="false" + fi + + echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "Deploy documents: $RESULT" + + publish: + runs-on: ubuntu-latest + needs: pre-publish + if: needs.pre-publish.outputs.result == 'true' + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install Requirements + run: | + python -m pip install --upgrade pip + python -m pip install -e ".[docs]" + python -m pip install -e ".[env]" + + - name: Run script to generate references + run: python scripts/gen_ref_pages.py + + - name: Determine versioning parameters + id: determine-versioning + run: | + # Read the first line from the VERSION file + LINE=$(head -n 1 ./VERSION) + + # Extract version and alias using parameter expansion + VERSION="${LINE%%|*}" + ALIAS="${LINE#*|}" + + # Print the extracted values for verification + echo "Version: $VERSION" + echo "Alias: $ALIAS" + + echo "Ragas_DOCS_VERSION=$VERSION" >> $GITHUB_ENV + echo "Ragas_DOCS_ALIAS=$ALIAS" >> $GITHUB_ENV + + - name: Deploy + if: ${{ env.Ragas_DOCS_VERSION }} != null + run: | + # Publishing implies creating a git commit on the production branch, + # We will need to create a user for this at some point + git config user.name "github-actions[bot]" + git config user.email "{user.id}+{user.login}@users.noreply.github.com" + git fetch --no-tags --prune --depth=1 origin +refs/heads/gh-pages:refs/remotes/origin/gh-pages + mike deploy \ + --update-aliases \ + --push \ + --remote origin \ + ${{ env.Ragas_DOCS_VERSION }} \ + ${{ env.Ragas_DOCS_ALIAS }} diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..643d9ca56 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0|dev \ No newline at end of file diff --git a/docs/howtos/index.md b/docs/howtos/index.md index 5dcb20373..3cac81521 100644 --- a/docs/howtos/index.md +++ b/docs/howtos/index.md @@ -27,5 +27,4 @@ Each guide in this section provides a focused solution to real-world problems th How to integrate Ragas with other frameworks and observability tools. Use Ragas with frameworks like [Langchain](integrations/langchain.md), [LlamaIndex](integrations/llamaindex.md), and [observability tools](). - diff --git a/pyproject.toml b/pyproject.toml index bf8093a7b..5a6cee78a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ docs = [ "mkdocs-section-index", "mkdocs-git-committers-plugin-2", "mkdocs-git-revision-date-localized-plugin", + "mike", ] [tool.setuptools] package-dir = {"" = "src"}