-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #332 from EGA-archive/develop
Testing the live update of the API version
- Loading branch information
Showing
6 changed files
with
76 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
api_version: v2.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters