Skip to content

Commit

Permalink
Merge pull request #332 from EGA-archive/develop
Browse files Browse the repository at this point in the history
Testing the live update of the API version
  • Loading branch information
costero-e authored May 30, 2024
2 parents 8c5f40c + 93c921c commit a788560
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 13 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/update_api_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@



name: update api version

on:
push:
branches: ['develop']

jobs:
updateapiversion:
runs-on: ubuntu-latest
steps:
- name: checkout repo content
uses: actions/checkout@v3 # checkout the repository content to github runner.
- name: setup python
uses: actions/setup-python@v4
with:
python-version: 3.8 #install the python needed
- name: Install dependencies
run: |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: execute py script
run: |
python beacon/api_version.py
git config --global user.email "[email protected]"
git config --global user.name "API version update"
git add .
git commit -m "api version automatically generated"
git push
25 changes: 25 additions & 0 deletions beacon/api_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import subprocess
import yaml


repo_url = 'https://github.com/EGA-archive/beacon2-ri-api.git'
output_lines = subprocess.check_output(
[
"git",
"ls-remote",
"--tags",
"--refs",
"--sort=version:refname",
repo_url,
],
encoding="utf-8",
).splitlines()
last_line_ref = output_lines[-2].rpartition("/")[-1]

with open("beacon/api_version.yml") as api_version_file:
api_version = yaml.safe_load(api_version_file)

api_version['api_version']=last_line_ref

with open("beacon/api_version.yml", 'w') as out:
yaml.dump(api_version, out)
1 change: 1 addition & 0 deletions beacon/api_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
api_version: v2.0.1
16 changes: 8 additions & 8 deletions beacon/conf.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from datetime import date
import datetime
import glob
import os
import yaml

with open("beacon/api_version.yml") as api_version_file:
api_version = yaml.safe_load(api_version_file)

"""Beacon Configuration."""


#
# Beacon general info
#
beacon_id = 'org.ega-archive.beacon-ri-demo' # ID of the Beacon
beacon_name = 'Beacon Reference Implementation demo' # Name of the Beacon service
api_version = 'v2.0.0' # Version of the Beacon implementation
uri = 'https://beacon-apis-demo.ega-archive.org/api/'
beacon_id = 'org.ega-archive.gdi-spanish-beacon' # ID of the Beacon
beacon_name = 'GDI Spanish Beacon' # Name of the Beacon service
api_version = api_version['api_version'] # Version of the Beacon implementation
uri = 'https://beacon-spain.ega-archive.org/api/'

#
# Beacon granularity
Expand Down
14 changes: 10 additions & 4 deletions deploy/conf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import yaml

with open("beacon/api_version.yml") as api_version_file:
api_version = yaml.safe_load(api_version_file)

"""Beacon Configuration."""


#
# Beacon general info
#
beacon_id = 'org.ega-archive.beacon-ri-demo' # ID of the Beacon
beacon_name = 'Beacon Reference Implementation demo' # Name of the Beacon service
api_version = 'v2.0.0' # Version of the Beacon implementation
uri = 'https://beacon-apis-demo.ega-archive.org/api/'
beacon_id = 'org.ega-archive.gdi-spanish-beacon' # ID of the Beacon
beacon_name = 'GDI Spanish Beacon' # Name of the Beacon service
api_version = api_version['api_version'] # Version of the Beacon implementation
uri = 'https://beacon-spain.ega-archive.org/api/'

#
# Beacon granularity
Expand Down
3 changes: 2 additions & 1 deletion deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ services:
###########################################

beacon-ri-tools:
image: beacon2ri/beacon_reference_implementation:v2.0.0
image: ghcr.io/ega-archive/beacon2-ri-tools-v2:main
hostname: beacon-ri-tools
container_name: ri-tools
networks:
- beacon-priv
tty: true
Expand Down

0 comments on commit a788560

Please sign in to comment.