Files
VoidLoaderCore/Jenkinsfile
T
faumaray 0cf66f18dc
VoidLoader/VoidLoaderCore/pipeline/head This commit looks good
trying to fix release
Signed-off-by: Faumaray <faumaray@gmail.com>
2025-10-19 04:23:43 +03:00

88 lines
3.0 KiB
Groovy

pipeline {
agent any
stages {
stage('Build-Linux') {
tools {
jdk 'JDK21'
}
steps {
sh 'java -version'
sh 'echo $JAVA_HOME'
sh 'rm -rf build/linux'
sh 'mkdir -p build/linux'
sh 'cmake -B build/linux -DCMAKE_BUILD_TYPE=Release'
sh 'cmake --build build/linux'
}
}
stage('Build-Windows') {
tools {
jdk 'JDK21-WIN'
}
steps {
sh 'java -version'
sh 'echo $JAVA_HOME'
sh 'rm -rf build/windows'
sh 'mkdir -p build/windows'
sh 'cmake -B build/windows -DCMAKE_TOOLCHAIN_FILE=mingw.cmake -DCMAKE_BUILD_TYPE=Release'
sh 'cmake --build build/windows'
}
}
stage('Package-Artifacts') {
steps {
sh '''
rm -rf dist
mkdir -p dist/native/windows
mkdir -p dist/native/linux
# copy linux .so and .so.* files
find build/linux -type f -name "*.so*" -exec cp {} dist/native/linux/ \\;
# copy windows dll files
find build/windows -type f -name "*.dll" -exec cp {} dist/native/windows/ \\;
# create zip
cd dist
zip -r ../VoidLoader.zip native
'''
}
post {
success {
archiveArtifacts artifacts: 'VoidLoader.zip', fingerprint: true
}
}
}
stage('Publish-To-Gitea') {
steps {
withCredentials([string(credentialsId: 'GITEA_TOKEN', variable: 'GITEA_TOKEN')]) {
sh '''
GITEA_URL="https://git.faumaray.ru"
REPO="VoidLoader/VoidLoaderCore"
TAG="build-${BUILD_NUMBER}"
# Create release if it does not exist
curl -X POST -H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\\"tag_name\\": \\"$TAG\\", \\"name\\": \\"$TAG\\"}" \
$GITEA_URL/api/v1/repos/$REPO/releases || true
# Get release ID
RELEASE_ID=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
"$GITEA_URL/api/v1/repos/$REPO/releases/tags/$TAG" | jq -r '.id')
echo "Release ID = $RELEASE_ID"
# Upload asset
curl -X POST -H "Authorization: token $GITEA_TOKEN" \
-F "attachment=@VoidLoader.zip" \
"$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets"
'''
}
}
}
}
}