Skip to content

Commit

Permalink
Updated indexing process
Browse files Browse the repository at this point in the history
  • Loading branch information
StrahinjaJacimovic committed Jul 2, 2024
1 parent bcafd0b commit 10813f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: Index Latest Release

on:
workflow_dispatch:
inputs:
select_index:
type: choice
description: Index as test or live
options:
- Test
- Live

jobs:
index:
Expand All @@ -28,7 +35,13 @@ jobs:
- name: Run Index Script
env:
ES_HOST: ${{ secrets.ES_HOST }}
ES_INDEX: ${{ secrets.ES_INDEX }}
ES_USER: ${{ secrets.ES_USER }}
ES_PASSWORD: ${{ secrets.ES_PASSWORD }}
run: python -u scripts/index.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ ${{ github.event.inputs.select_index }} == "Live" ]]; then
echo "Indexing to Live."
python -u scripts/index.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ secrets.ES_INDEX_LIVE }}
else
echo "Indexing to Test."
python -u scripts/index.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ secrets.ES_INDEX_TEST }}
fi
3 changes: 2 additions & 1 deletion scripts/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def index_release_to_elasticsearch(es : Elasticsearch, index_name, release_detai
parser = argparse.ArgumentParser(description="Upload directories as release assets.")
parser.add_argument("repo", help="Repository name, e.g., 'username/repo'")
parser.add_argument("token", help="GitHub Token")
parser.add_argument("select_index", help="Provided index name")
args = parser.parse_args()

# Elasticsearch instance used for indexing
Expand All @@ -127,7 +128,7 @@ def index_release_to_elasticsearch(es : Elasticsearch, index_name, release_detai

# Now index the new release
index_release_to_elasticsearch(
es, os.environ['ES_INDEX'],
es, args.select_index,
fetch_release_details(args.repo, args.token),
args.token
)

0 comments on commit 10813f9

Please sign in to comment.