-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
endpoint to return the latest release version from the git repository
- Loading branch information
1 parent
d422f19
commit fdb7809
Showing
4 changed files
with
28 additions
and
0 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
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,18 @@ | ||
from rest_framework.response import Response | ||
from rest_framework.views import APIView | ||
import subprocess | ||
import requests | ||
|
||
class GitAPIView(APIView): | ||
def get(self, request): | ||
#version = subprocess.check_output(["git", "describe", "--tags", "--abbrev=0"]) | ||
#request on https://api.github.com/repos/linea-it/pzserver_app/releases/latest | ||
project = 'pzserver_app' | ||
response = requests.get(f"https://api.github.com/repos/linea-it/{project}/releases/latest") | ||
data = response.json() | ||
return Response({"version": data['name']}) | ||
|
||
|
||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { api } from './api' | ||
|
||
export const getVersion = ({ }) => { | ||
return api.get('/api/git/').then(res => res.data) | ||
} |