Skip to content

Feature/ci with mike #1437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/mike-deploy.yml
Original file line number Diff line number Diff line change
@@ -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 }}
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0|dev
1 change: 0 additions & 1 deletion docs/howtos/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]().

</div>
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
Loading