main
Dmitry Kirdyashkin 2023-05-16 22:59:59 +03:00
parent c123b34f3f
commit 86755130f9
5 changed files with 28 additions and 62 deletions

1
.gitignore vendored 100644
View File

@ -0,0 +1 @@
temp

53
Jenkinsfile vendored
View File

@ -1,53 +0,0 @@
pipeline {
agent any
environment {
VERSION_STR = "$BUILD_NUMBER"
DOWNLOAD_STR = "http://192.168.1.200:8082/repository/zip-repo/shared-compendia/shared-compendia/${BUILD_NUMBER}/shared-compendia-${BUILD_NUMBER}.zip"
}
stages {
stage('modifying module.json') {
steps {
sh "sed -i 's_\"version\":.*\$_\"version\": \"${BUILD_NUMBER}\",_;s_\"download\":.*\$_\"download\": \"${DOWNLOAD_STR}\",_' module.json"
}
}
stage('copy module.json') {
steps {
sh "cp -f module.json src/module.json"
}
}
stage('archive artifacts') {
steps {
archiveArtifacts artifacts: 'module.json', fingerprint: true
}
}
stage('generate archive') {
steps {
zip zipFile: "shared-compendia-${BUILD_NUMBER}.zip", archive: false, overwrite: true, dir: "src"
}
}
stage('upload artifact') {
steps {
nexusArtifactUploader (
artifacts: [
[
artifactId: "shared-compendia",
classifier: '',
file: "shared-compendia-${BUILD_NUMBER}.zip",
type: 'zip'
]
],
credentialsId: '190405b3-4cdf-4475-85ed-a3a7713cb6eb',
groupId: 'shared-compendia',
nexusUrl: '192.168.1.200:8082',
nexusVersion: 'nexus3',
protocol: 'http',
repository: 'zip-repo',
version: '$BUILD_NUMBER'
)
sh 'curl --user jenkins:12345678 --upload-file module.json http://192.168.1.200:8082/repository/zip-repo/shared-compendia/module.json'
}
}
}
}

View File

@ -0,0 +1,5 @@
---
- 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,18 @@
$tempFolder = "C:\Users\dmitr\Documents\Repos\local\fvtt-shared-compendia\temp"
$dbFolder = "C:\Users\dmitr\Documents\Repos\local\fvtt-shared-compendia\src\packs"
$archiveList = Invoke-RestMethod -Method Get https://nexus.kdiva.ru/service/rest/v1/search?repository=generic
$archiveUrl = $archiveList.items.assets | Sort-Object -Property lastModified | Select-Object -ExpandProperty downloadUrl -Last 1
$archiveName = [System.IO.Path]::GetFileName($archiveUrl)
if (!(Test-Path -Path $tempFolder)){
New-Item -Path $tempFolder -ItemType Directory -Force
}
Invoke-RestMethod -Method Get -Uri $archiveUrl -OutFile $tempFolder\$archiveName
Expand-Archive -Force -Path $tempFolder\$archiveName -DestinationPath $tempFolder
Get-ChildItem -Path $tempFolder -Filter "*.db" | foreach $_ {Move-Item -Force -Path $_ -Destination $dbFolder}
Remove-Item -Force -Recurse -Path $tempFolder

File diff suppressed because one or more lines are too long