mirror of
https://github.com/znc/znc.git
synced 2026-07-04 00:41:38 +02:00
Remove CI file which is not used anymore.
The actual version is in master branch, and it affects both branches: master and 1.7.x
This commit is contained in:
@@ -1,73 +0,0 @@
|
||||
#!groovy
|
||||
// This script is run daily by https://jenkins.znc.in/ to:
|
||||
// * upload new English strings to https://crowdin.com/project/znc-bouncer
|
||||
// * download new translations
|
||||
// * create a pull request with results to ZNC repo
|
||||
|
||||
import groovy.json.JsonSlurper;
|
||||
|
||||
// TODO refactor this after ZNC 1.7 is released, because we'll need many branches
|
||||
def upstream_user = 'znc'
|
||||
def upstream_repo = 'znc'
|
||||
def upstream_branch = 'master'
|
||||
def my_user = 'znc-jenkins'
|
||||
def my_repo = 'znc'
|
||||
def my_branch = 'l10n_master'
|
||||
|
||||
timestamps {
|
||||
node {
|
||||
timeout(time: 30, unit: 'MINUTES') {
|
||||
def crowdin_cli = "java -jar ${tool 'crowdin-cli'}/crowdin-cli.jar --config .ci/crowdin.yml"
|
||||
stage('Checkout') {
|
||||
step([$class: 'WsCleanup'])
|
||||
checkout([$class: 'GitSCM', branches: [[name: "*/${upstream_branch}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'SubmoduleOption', recursiveSubmodules: true]], userRemoteConfigs: [[credentialsId: '6ef10f80-20dc-4661-af45-52a6e1e15749', name: 'upstream', url: "github.com:${upstream_user}/${upstream_repo}.git"]]])
|
||||
}
|
||||
stage('Prepare strings') {
|
||||
dir("build") {
|
||||
sh "cmake .."
|
||||
sh 'make translation'
|
||||
}
|
||||
sh 'rm -rf build/'
|
||||
sh 'git status'
|
||||
}
|
||||
stage('Crowdin') {
|
||||
withCredentials([string(credentialsId: '11c7e2b4-f990-4670-98a4-c89d2a5a2f43', variable: 'CROWDIN_API_KEY')]) {
|
||||
withEnv(['CROWDIN_BASE_PATH='+pwd()]) {
|
||||
sh "$crowdin_cli upload sources --branch ${upstream_branch}"
|
||||
// sh "$crowdin_cli upload translations --branch ${upstream_branch}"
|
||||
sh "$crowdin_cli download --branch ${upstream_branch}"
|
||||
}
|
||||
}
|
||||
sh 'find . -name "*.po" -exec msgfilter -i "{}" -o "{}.replacement" .ci/cleanup-po.pl ";"'
|
||||
sh 'find . -name "*.po" -exec mv "{}.replacement" "{}" ";"'
|
||||
}
|
||||
stage('Push') {
|
||||
sh 'git config user.name "ZNC-Jenkins"'
|
||||
sh 'git config user.email jenkins@znc.in'
|
||||
sh 'git status'
|
||||
sh 'git add .'
|
||||
try {
|
||||
sh 'git commit -m "Update translations from Crowdin"'
|
||||
} catch(e) {
|
||||
echo 'No changes found'
|
||||
return
|
||||
}
|
||||
sh "git remote add my github.com:${my_user}/${my_repo}.git"
|
||||
sshagent(credentials: ['6ef10f80-20dc-4661-af45-52a6e1e15749']) {
|
||||
sh "git push my HEAD:refs/heads/${my_branch} -f"
|
||||
}
|
||||
// Create pull request if it doesn't exist yet
|
||||
withCredentials([string(credentialsId: '7a2546ae-8a29-4eab-921c-6a4803456dce', variable: 'GITHUB_OAUTH_KEY')]) {
|
||||
def headers = [[maskValue: true, name: 'Authorization', value: "token ${env.GITHUB_OAUTH_KEY}"], [maskValue: false, name: 'Accept', value: 'application/vnd.github.v3+json'], [maskValue: false, name: 'User-Agent', value: 'https://github.com/znc/znc/blob/master/.ci/Jenkinsfile.crowdin']]
|
||||
def pulls = httpRequest consoleLogResponseBody: true, customHeaders: headers, url: "https://api.github.com/repos/${upstream_user}/${upstream_repo}/pulls?head=${my_user}:${my_branch}&base=${upstream_branch}"
|
||||
pulls = new JsonSlurper().parseText(pulls.content)
|
||||
if (!pulls) {
|
||||
httpRequest consoleLogResponseBody: true, customHeaders: headers, url: "https://api.github.com/repos/${upstream_user}/${upstream_repo}/pulls", httpMode: 'POST', requestBody: '{"head":"'+my_user+':'+my_branch+'","base":"'+upstream_branch+'","title":"Update translations","body":"From https://crowdin.com/project/znc-bouncer"}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// vim: set ts=2 sw=2 et:
|
||||
Reference in New Issue
Block a user