-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Automate version updates (#68)
* chore: Automate version changing * feat: automate version front * fix: python response default value fix * fix: title version fix * chore: Update Readme & version --------- Co-authored-by: MXerFix <[email protected]>
- Loading branch information
1 parent
c9427d5
commit 21959ba
Showing
14 changed files
with
175 additions
and
68 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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
from fastapi import APIRouter | ||
|
||
from app.api.api_v1.endpoints import bot, dff_services, flows | ||
from app.api.api_v1.endpoints import bot, dff_services, flows, config | ||
from app.core.config import settings | ||
|
||
api_router = APIRouter() | ||
|
||
api_router.include_router(config.router, prefix="/".join([settings.API_V1_STR, "config"]), tags=["config"]) | ||
api_router.include_router(flows.router, prefix="/".join([settings.API_V1_STR, "flows"]), tags=["flows"]) | ||
api_router.include_router(dff_services.router, prefix="/".join([settings.API_V1_STR, "services"]), tags=["services"]) | ||
api_router.include_router(bot.router, prefix="/".join([settings.API_V1_STR, "bot"]), tags=["bot"]) |
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,14 @@ | ||
from fastapi import APIRouter | ||
|
||
import toml | ||
|
||
from app.core.config import settings | ||
|
||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get("/version") | ||
async def get_version(): | ||
pyproject = toml.load(settings.pyproject_path) | ||
return pyproject["tool"]["poetry"]["version"] |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { $v1 } from "." | ||
|
||
|
||
|
||
export const get_config_version = async () => { | ||
return (await $v1.get("/config/version")).data | ||
} |
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
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,35 @@ | ||
import React, { createContext, useEffect, useState } from "react" | ||
import { get_config_version } from "../api/meta" | ||
|
||
// context to set JSX element on the DOM | ||
|
||
type metaContextType = { | ||
version: string | ||
setVersion: React.Dispatch<React.SetStateAction<string>> | ||
} | ||
|
||
export const MetaContext = createContext<metaContextType>({ | ||
version: "", | ||
setVersion: () => {}, | ||
}) | ||
|
||
interface MetaProviderProps { | ||
children: React.ReactNode | ||
} | ||
|
||
const MetaProvider = ({ children }: MetaProviderProps) => { | ||
const [version, setVersion] = useState<string>("") | ||
|
||
const getVersion = async () => { | ||
const version_data = await get_config_version() | ||
setVersion(version_data) | ||
} | ||
|
||
useEffect(() => { | ||
getVersion() | ||
}, []) | ||
|
||
return <MetaContext.Provider value={{ version, setVersion }}>{children}</MetaContext.Provider> | ||
} | ||
|
||
export default MetaProvider |
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