update
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
GITEA_ACCESS_TOKEN=528ed6363ba47884c05235cff9ba47e38b4201d5
|
||||||
|
GITEA_USERNAME=hoangvv
|
||||||
|
GITEA_PASSWORD=smartyourlife
|
||||||
|
GITEA_HOST = https://git.nextzenos.com/api/v1
|
||||||
@@ -21,3 +21,5 @@
|
|||||||
# Go workspace file
|
# Go workspace file
|
||||||
go.work
|
go.work
|
||||||
|
|
||||||
|
venv/
|
||||||
|
*.zip
|
||||||
|
|||||||
+28
-18
@@ -1,4 +1,13 @@
|
|||||||
{
|
{
|
||||||
|
"id": "bifrost",
|
||||||
|
"name": "Bifrost",
|
||||||
|
"description": "Bifrost is a platform for building and deploying applications.",
|
||||||
|
"deployment": {
|
||||||
|
"type": "native"
|
||||||
|
},
|
||||||
|
"installation": {
|
||||||
|
"host_type": "local"
|
||||||
|
},
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"key": "nextzenos",
|
"key": "nextzenos",
|
||||||
@@ -38,45 +47,46 @@
|
|||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
"key": "Website",
|
"key": "server-panel",
|
||||||
"name": "Website",
|
"name": "Server Panel",
|
||||||
"sort": 1
|
"sort": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "Database",
|
"key": "database",
|
||||||
"name": "Database",
|
"name": "Database",
|
||||||
"sort": 2
|
"sort": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "Server",
|
"key": "firewall",
|
||||||
"name": "Web Server",
|
"name": "FireWall",
|
||||||
"sort": 3
|
"sort": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "Runtime",
|
"key": "tool",
|
||||||
"name": "Runtime",
|
"name": "Utility",
|
||||||
"sort": 4
|
"sort": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "Tool",
|
"key": "vpn",
|
||||||
"name": "Utility",
|
"name": "VPN",
|
||||||
"sort": 5
|
"sort": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "DevTool",
|
"key": "nas",
|
||||||
"name": "Development tool",
|
"name": "NAS",
|
||||||
"sort": 10
|
"sort": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "Middleware",
|
"key": "cli",
|
||||||
"name": "Middleware",
|
"name": "CLI",
|
||||||
"sort": 12
|
"sort": 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "Local",
|
"key": "api",
|
||||||
"name": "Local",
|
"name": "API",
|
||||||
"sort": 99
|
"sort": 6
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"version": "1.0.0",
|
||||||
"lastModified": 1746671214
|
"lastModified": 1746671214
|
||||||
}
|
}
|
||||||
+3
-3
@@ -6,9 +6,9 @@
|
|||||||
"deployment": {
|
"deployment": {
|
||||||
"type": "docker"
|
"type": "docker"
|
||||||
},
|
},
|
||||||
"location": {
|
"installation": {
|
||||||
"host_type": "local",
|
"host_type": "local"
|
||||||
"installation_path": "/opt/bifrost/apps/nextcloud"
|
|
||||||
},
|
},
|
||||||
|
"tags": [],
|
||||||
"lastModified": 1746671214
|
"lastModified": 1746671214
|
||||||
}
|
}
|
||||||
+2
-1
@@ -6,9 +6,10 @@
|
|||||||
"deployment": {
|
"deployment": {
|
||||||
"type": "native"
|
"type": "native"
|
||||||
},
|
},
|
||||||
"location": {
|
"installation": {
|
||||||
"host_type": "remote",
|
"host_type": "remote",
|
||||||
"host": "10.0.0.1"
|
"host": "10.0.0.1"
|
||||||
},
|
},
|
||||||
|
"tags": [],
|
||||||
"lastModified": 1746671214
|
"lastModified": 1746671214
|
||||||
}
|
}
|
||||||
+2
-1
@@ -6,9 +6,10 @@
|
|||||||
"deployment": {
|
"deployment": {
|
||||||
"type": "native"
|
"type": "native"
|
||||||
},
|
},
|
||||||
"location": {
|
"installation": {
|
||||||
"host_type": "remote",
|
"host_type": "remote",
|
||||||
"host": "10.0.0.1"
|
"host": "10.0.0.1"
|
||||||
},
|
},
|
||||||
|
"tags": [],
|
||||||
"lastModified": 1746671214
|
"lastModified": 1746671214
|
||||||
}
|
}
|
||||||
+2
-1
@@ -6,8 +6,9 @@
|
|||||||
"deployment": {
|
"deployment": {
|
||||||
"type": "native"
|
"type": "native"
|
||||||
},
|
},
|
||||||
"location": {
|
"locinstallationation": {
|
||||||
"host_type": "local"
|
"host_type": "local"
|
||||||
},
|
},
|
||||||
|
"tags": [],
|
||||||
"lastModified": 1746671214
|
"lastModified": 1746671214
|
||||||
}
|
}
|
||||||
+3
-3
@@ -6,9 +6,9 @@
|
|||||||
"deployment": {
|
"deployment": {
|
||||||
"type": "docker"
|
"type": "docker"
|
||||||
},
|
},
|
||||||
"location": {
|
"installation": {
|
||||||
"host_type": "local",
|
"host_type": "local"
|
||||||
"installation_path": "/opt/bifrost/apps/nextvpn"
|
|
||||||
},
|
},
|
||||||
|
"tags": [],
|
||||||
"lastModified": 1746671214
|
"lastModified": 1746671214
|
||||||
}
|
}
|
||||||
+3
-3
@@ -6,10 +6,10 @@
|
|||||||
"deployment": {
|
"deployment": {
|
||||||
"type": "docker"
|
"type": "docker"
|
||||||
},
|
},
|
||||||
"location": {
|
"installation": {
|
||||||
"host_type": "local",
|
"host_type": "local"
|
||||||
"installation_path": "/opt/bifrost/apps/nextweb"
|
|
||||||
},
|
},
|
||||||
"apps": [],
|
"apps": [],
|
||||||
|
"tags": [],
|
||||||
"lastModified": 1746671214
|
"lastModified": 1746671214
|
||||||
}
|
}
|
||||||
+3
-2
@@ -1,14 +1,15 @@
|
|||||||
{
|
{
|
||||||
"id": "nextzenos",
|
"id": "nextzenos",
|
||||||
"name": "NextZenOS",
|
"name": "NextzenOS",
|
||||||
"version": "1.4",
|
"version": "1.4",
|
||||||
"description": "",
|
"description": "",
|
||||||
"deployment": {
|
"deployment": {
|
||||||
"type": "native"
|
"type": "native"
|
||||||
},
|
},
|
||||||
"location": {
|
"installation": {
|
||||||
"host_type": "local"
|
"host_type": "local"
|
||||||
},
|
},
|
||||||
"apps": [],
|
"apps": [],
|
||||||
|
"tags": [],
|
||||||
"lastModified": 1746671214
|
"lastModified": 1746671214
|
||||||
}
|
}
|
||||||
+6
-1
@@ -1,6 +1,8 @@
|
|||||||
REGISTRY_PATH = $(shell pwd)/registry
|
REGISTRY_PATH = $(shell pwd)/registry
|
||||||
REGISTRY_REPO = git.nextzenos.com/CDN/bifrost-registry.git
|
REGISTRY_REPO = git.nextzenos.com/CDN/bifrost-registry.git
|
||||||
update_registry:
|
RELEASE_UID = 8845
|
||||||
|
PYTHON = $(REGISTRY_PATH)/venv/bin/python
|
||||||
|
update_registry: package_registry upload_registry
|
||||||
( cd $(REGISTRY_PATH) && \
|
( cd $(REGISTRY_PATH) && \
|
||||||
@read -p "Enter your commit message: " commit_msg; \
|
@read -p "Enter your commit message: " commit_msg; \
|
||||||
git pull https://$(GIT_USER):$(GIT_PASS)@$(REGISTRY_REPO) || true; \
|
git pull https://$(GIT_USER):$(GIT_PASS)@$(REGISTRY_REPO) || true; \
|
||||||
@@ -11,3 +13,6 @@ update_registry:
|
|||||||
package_registry:
|
package_registry:
|
||||||
(cd $(REGISTRY_PATH) && \
|
(cd $(REGISTRY_PATH) && \
|
||||||
zip -r registry.zip *.json -x .gitignore .git .mk)
|
zip -r registry.zip *.json -x .gitignore .git .mk)
|
||||||
|
|
||||||
|
upload_registry:
|
||||||
|
$(PYTHON) $(REGISTRY_PATH)/scripts/main.py
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
python-dotenv ; python_version > '3.10'
|
||||||
|
git+https://github.com/dblueai/giteapy.git ; python_version > '3.10'
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
|||||||
|
from .config import GiteaConfig
|
||||||
|
from .api import GiteaApi
|
||||||
|
|
||||||
|
__all__ = ["GiteaConfig", "GiteaApi"]
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,26 @@
|
|||||||
|
import giteapy
|
||||||
|
from .config import GiteaConfig
|
||||||
|
|
||||||
|
|
||||||
|
class GiteaApi:
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.config = GiteaConfig().configuration
|
||||||
|
|
||||||
|
def admin_gitea_instance(self):
|
||||||
|
return giteapy.AdminApi(giteapy.ApiClient(self.config))
|
||||||
|
|
||||||
|
def repo_gitea_instance(self):
|
||||||
|
return giteapy.RepositoryApi(giteapy.ApiClient(self.config))
|
||||||
|
|
||||||
|
def user_gitea_instance(self):
|
||||||
|
return giteapy.UserApi(giteapy.ApiClient(self.config))
|
||||||
|
|
||||||
|
def org_gitea_instance(self):
|
||||||
|
return giteapy.OrganizationApi(giteapy.ApiClient(self.config))
|
||||||
|
|
||||||
|
def misc_gitea_instance(self):
|
||||||
|
return giteapy.MiscellaneousApi(giteapy.ApiClient(self.config))
|
||||||
|
|
||||||
|
def issue_gitea_instance(self):
|
||||||
|
return giteapy.IssueApi(giteapy.ApiClient(self.config))
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import os
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import giteapy
|
||||||
|
|
||||||
|
# Automatically look for .env in the project root
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
|
||||||
|
class GiteaConfig:
|
||||||
|
def __init__(self):
|
||||||
|
self.configuration = giteapy.Configuration()
|
||||||
|
self.configuration.host = os.getenv("GITEA_HOST")
|
||||||
|
self.configuration.api_key["Authorization"] = os.getenv("GITEA_ACCESS_TOKEN")
|
||||||
|
self.configuration.api_key_prefix["Authorization"] = "Bearer"
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
from gitea.api import GiteaApi
|
||||||
|
from gitea.config import GiteaConfig
|
||||||
|
import giteapy
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
gitea_instance = GiteaApi()
|
||||||
|
admin_instance = gitea_instance.admin_gitea_instance()
|
||||||
|
repo_instance = gitea_instance.repo_gitea_instance()
|
||||||
|
|
||||||
|
# Parameters
|
||||||
|
owner = "CDN" # Owner of the repository
|
||||||
|
repo = "bifrost-registry" # Repository name
|
||||||
|
release_id = 8845 # The ID of the release to attach to
|
||||||
|
attachment_path = (
|
||||||
|
"/root/dev/Bifrost/registry/registry.zip" # Path to the file you want to upload
|
||||||
|
)
|
||||||
|
get_release_response = repo_instance.repo_get_release(
|
||||||
|
owner=owner,
|
||||||
|
repo=repo,
|
||||||
|
id=release_id, # Release ID
|
||||||
|
)
|
||||||
|
assets = get_release_response.assets
|
||||||
|
attachment_id = None
|
||||||
|
for asset in assets:
|
||||||
|
if asset.name == "registry.zip":
|
||||||
|
attachment_id = asset.id
|
||||||
|
repo_instance.repo_delete_release_attachment(
|
||||||
|
owner=owner,
|
||||||
|
repo=repo,
|
||||||
|
id=release_id, # Release ID
|
||||||
|
attachment_id=attachment_id,
|
||||||
|
)
|
||||||
|
create_response = repo_instance.repo_create_release_attachment(
|
||||||
|
owner=owner,
|
||||||
|
repo=repo,
|
||||||
|
id=release_id, # Release ID
|
||||||
|
attachment=attachment_path,
|
||||||
|
name=os.path.basename(attachment_path), # Filename for the attachment
|
||||||
|
)
|
||||||
|
print(create_response)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user