Skip to content

Commit

Permalink
Adding qualified version for analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
alallema committed May 30, 2023
1 parent e6c1936 commit 5f2b3a3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/scripts/check-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# Checking if current tag matches the package version
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | sed -r 's/^v//')
file_tag=$(grep '__version__ =' meilisearch/version.py | cut -d '=' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
if [ "$current_tag" != "$file_tag" ]; then
echo "Error: the current tag does not match the version in package file(s)."
echo "$current_tag vs $file_tag"
exit 1
fi

echo 'OK'
exit 0
3 changes: 3 additions & 0 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Check release validity
run: sh .github/scripts/check-release.sh

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand Down
3 changes: 2 additions & 1 deletion scraper/src/config/config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import os
import copy

from .version import qualified_version
from .config_validator import ConfigValidator
from .urls_parser import UrlsParser
from .selectors_parser import SelectorsParser
Expand Down Expand Up @@ -44,7 +45,7 @@ class ConfigLoader:
strict_redirect = True
strip_chars = ".,;:§¶"
use_anchors = False
user_agent = 'Meilisearch docs-scraper'
user_agent = qualified_version()
only_content_level = False
query_rules = []

Expand Down
9 changes: 9 additions & 0 deletions scraper/src/config/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from __future__ import annotations

__version__ = "0.12.9"


def qualified_version() -> str:
"""Get the qualified version of this module."""

return f"Meilisearch Docs-scraper (v{__version__})"

0 comments on commit 5f2b3a3

Please sign in to comment.