main
Dmitry Kirdyashkin 2023-05-17 00:38:07 +03:00
parent 933349f595
commit ede9492da7
4 changed files with 183 additions and 124 deletions

View File

@ -1,5 +0,0 @@
---
- name: archive db
archive:
path: /mnt/data/foundryvtt-v10/Data/modules/shared-compendia/packs
dest: /mnt/data/temp.tar.gz

View File

@ -0,0 +1,42 @@
function update-archive {
param (
#$exclude = @(".gitignore","export","audio","temp",".git","create-archive.ps1"),
$workFolder = "..\modules",
$moduleName = "shared-compendia",
$uploadPath = "http://192.168.1.200:8082/repository/zip-repo"
)
#изменение версии и пути скачивания
Write-Host -ForegroundColor Cyan "`nModifying module.json..."
$content = Get-Content "$workFolder\$moduleName\src\module.json" | ConvertFrom-Json
$oldVersion = $content.version
$oldIndex = $oldVersion.ToString().split(".")[2] -as [int]
$newIndex = ($oldIndex + 1).ToString()
$patch = $oldVersion.LastIndexOf(".")
$newVersion = $oldVersion.Substring(0, $patch) + "." + $newIndex
$content.version = $newVersion
$archiveName = "$moduleName-$newVersion.zip"
$content.download = "$uploadPath/$moduleName/$archiveName"
$content | ConvertTo-Json | Set-Content "$workFolder\$moduleName\src\module.json"
Write-Host "Version Changed $oldVersion -> $newVersion"
#создание архива
Write-Host -ForegroundColor Cyan "`nCreating archive..."
Get-ChildItem $workFolder\$moduleName\src\ -Recurse -Depth 0 |
Where-Object {$_.Name -notin $exclude} |
Compress-Archive -Force -DestinationPath "$workFolder\$moduleName\$archiveName"
Copy-Item -Path "$workFolder\$moduleName\src\module.json" -Destination "$workFolder\$moduleName\module.json" -Force
#загрузка архива
Write-Host -ForegroundColor Cyan "`nUploading archive..."
curl.exe --user upload:12345 --upload-file $workFolder\$moduleName\$archiveName $uploadPath/$moduleName/$archiveName --upload-file $workFolder\$moduleName\module.json $uploadPath/$moduleName/module.json
#проверка и удаление архива
$response = curl.exe --user upload:12345 -X GET 'http://192.168.1.200:8082/service/rest/v1/assets?repository=zip-repo' | ConvertFrom-Json
if ($response.items.path -like "*$archiveName*"){
Write-Host -ForegroundColor Cyan "`nUploaded successfully`nDeleting local archive..."
Remove-Item -Path $workFolder/$moduleName/*.zip
}
else {
Write-Host -ForegroundColor Red "Archive not found"
}
}

View File

@ -0,0 +1,22 @@
Import-Module ./update-archive.psm1
Import-Module ./update-db.psm1
#Скачивание обновлений БД мира
Write-Host -ForegroundColor Cyan -NoNewline "`nDownload DB updates?(y/n): "
$answerDbUpd = Read-Host
if ($answerDbUpd -eq "y"){
update-db
}
elseif ($answerDbUpd -eq "n") {
Write-Host "Skipping DB updates`n"
}
#Обновить модуль
Write-Host -ForegroundColor Cyan -NoNewline "`nUpdate archive?(y/n): "
$answerArchUpd = Read-Host
if ($answerArchUpd -eq "y"){
update-archive
}
elseif ($answerArchUpd -eq "n") {
break
}

View File

@ -1,121 +1,121 @@
{ {
"id": "shared-compendia", "id": "shared-compendia",
"name": "shared-compendia", "name": "shared-compendia",
"title": "Shared Compendia", "title": "Shared Compendia",
"description": "Personal compendia-sharing module.", "description": "Personal compendia-sharing module.",
"authors": [ "authors": [
{ {
"name": "leego neit" "name": "leego neit"
} }
], ],
"version": "1.0.68", "version": "1.0.74",
"minimumCoreVersion": "9", "minimumCoreVersion": "9",
"compatibility": { "compatibility": {
"minimum": "9", "minimum": "9",
"verified": "10", "verified": "10",
"maximum": "10" "maximum": "10"
}, },
"manifest": "http://192.168.1.200:8082/repository/zip-repo/shared-compendia/module.json", "manifest": "https://nexus.kdiva.ru/repository/generic/shared-compendia/module.json",
"download": "http://192.168.1.200:8082/repository/zip-repo/shared-compendia/shared-compendia-1.0.68.zip", "download": "https://nexus.kdiva.ru/repository/generic/shared-compendia/shared-compendia-1.0.74.zip",
"packs": [ "packs": [
{ {
"name": "sc-actors", "name": "sc-actors",
"label": "sc actors", "label": "sc actors",
"path": "packs/sc-actors.db", "path": "packs/sc-actors.db",
"entity": "Actor", "entity": "Actor",
"type": "Actor", "type": "Actor",
"module": "shared-compendia", "module": "shared-compendia",
"system": "dnd5e" "system": "dnd5e"
}, },
{ {
"name": "sc-creatures", "name": "sc-creatures",
"label": "sc creatures", "label": "sc creatures",
"path": "packs/sc-creatures.db", "path": "packs/sc-creatures.db",
"entity": "Actor", "entity": "Actor",
"type": "Actor", "type": "Actor",
"module": "shared-compendia", "module": "shared-compendia",
"system": "dnd5e" "system": "dnd5e"
}, },
{ {
"name": "sc-classes", "name": "sc-classes",
"label": "sc classes", "label": "sc classes",
"path": "packs/sc-classes.db", "path": "packs/sc-classes.db",
"entity": "Item", "entity": "Item",
"type": "Item", "type": "Item",
"module": "shared-compendia", "module": "shared-compendia",
"system": "dnd5e" "system": "dnd5e"
}, },
{ {
"name": "sc-class-features", "name": "sc-class-features",
"label": "sc class features", "label": "sc class features",
"path": "packs/sc-class-features.db", "path": "packs/sc-class-features.db",
"entity": "Item", "entity": "Item",
"type": "Item", "type": "Item",
"module": "shared-compendia", "module": "shared-compendia",
"system": "dnd5e" "system": "dnd5e"
}, },
{ {
"name": "sc-races", "name": "sc-races",
"label": "sc races", "label": "sc races",
"path": "packs/sc-races.db", "path": "packs/sc-races.db",
"entity": "Item", "entity": "Item",
"type": "Item", "type": "Item",
"module": "shared-compendia", "module": "shared-compendia",
"system": "dnd5e" "system": "dnd5e"
}, },
{ {
"name": "sc-racial-features", "name": "sc-racial-features",
"label": "sc racial features", "label": "sc racial features",
"path": "packs/sc-racial-features.db", "path": "packs/sc-racial-features.db",
"entity": "Item", "entity": "Item",
"type": "Item", "type": "Item",
"module": "shared-compendia", "module": "shared-compendia",
"system": "dnd5e" "system": "dnd5e"
}, },
{ {
"name": "sc-items", "name": "sc-items",
"label": "sc items", "label": "sc items",
"path": "packs/sc-items.db", "path": "packs/sc-items.db",
"entity": "Item", "entity": "Item",
"type": "Item", "type": "Item",
"module": "shared-compendia", "module": "shared-compendia",
"system": "dnd5e" "system": "dnd5e"
}, },
{ {
"name": "sc-spells", "name": "sc-spells",
"label": "sc spells", "label": "sc spells",
"path": "packs/sc-spells.db", "path": "packs/sc-spells.db",
"entity": "Item", "entity": "Item",
"type": "Item", "type": "Item",
"module": "shared-compendia", "module": "shared-compendia",
"system": "dnd5e" "system": "dnd5e"
}, },
{ {
"name": "sc-actions", "name": "sc-actions",
"label": "sc actions", "label": "sc actions",
"path": "packs/sc-actions.db", "path": "packs/sc-actions.db",
"entity": "Item", "entity": "Item",
"type": "Item", "type": "Item",
"module": "shared-compendia", "module": "shared-compendia",
"system": "dnd5e" "system": "dnd5e"
}, },
{ {
"name": "sc-conditions", "name": "sc-conditions",
"label": "sc conditions", "label": "sc conditions",
"path": "packs/sc-conditions.db", "path": "packs/sc-conditions.db",
"entity": "Item", "entity": "Item",
"type": "Item", "type": "Item",
"module": "shared-compendia", "module": "shared-compendia",
"system": "dnd5e" "system": "dnd5e"
}, },
{ {
"name": "sc-backgrounds", "name": "sc-backgrounds",
"label": "sc backgrounds", "label": "sc backgrounds",
"path": "packs/sc-backgrounds.db", "path": "packs/sc-backgrounds.db",
"entity": "Item", "entity": "Item",
"type": "Item", "type": "Item",
"module": "shared-compendia", "module": "shared-compendia",
"system": "dnd5e" "system": "dnd5e"
} }
] ]
} }