Add pipeline for releasing to github

This commit is contained in:
Romuald Juchnowicz-Bierbasz
2019-05-20 15:30:08 +02:00
committed by Romuald Bierbasz
parent be6c0eb03e
commit e62e7e0e6e
3 changed files with 39 additions and 0 deletions

12
jenkins/release.groovy Normal file
View File

@@ -0,0 +1,12 @@
stage('Upload to github')
{
node('ActiveClientWindowsBuilder') {
withPythonEnv('python') {
withCredentials([usernamePassword(credentialsId: 'github_friendsofgalaxy', usernameVariable: 'GITHUB_USERNAME', passwordVariable: 'GITHUB_TOKEN')]) {
bat 'pip install -r jenkins/requirements.txt'
version = bat(returnStdout: true, script: 'python setup.py --version').trim()
bat "python jenkins/release.py ${version}"
}
}
}
}

26
jenkins/release.py Normal file
View File

@@ -0,0 +1,26 @@
import os
import sys
from galaxy.github.exporter import transfer_repo
GITHUB_USERNAME = "FriendsOfGalaxy"
GITHUB_EMAIL = "friendsofgalaxy@gmail.com"
GITHUB_TOKEN = os.environ["GITHUB_TOKEN"]
GITHUB_REPO_NAME = "galaxy-plugin-api"
SOURCE_BRANCH = os.environ["GIT_REFSPEC"]
GITLAB_USERNAME = "galaxy-client"
GITLAB_REPO_NAME = "galaxy-plugin-api"
def version_provider():
return sys.argv[1]
gh_version = transfer_repo(
version_provider=version_provider,
source_repo_spec="git@gitlab.gog.com:{}/{}.git".format(GITLAB_USERNAME, GITLAB_REPO_NAME),
source_include_elements=["src", "tests", "requirements.txt", ".gitignore", "*.md", "pytest.ini"],
source_branch=SOURCE_BRANCH,
dest_repo_spec="https://{}:{}@github.com/{}/{}.git".format(GITHUB_USERNAME, GITHUB_TOKEN, GITHUB_USERNAME, GITHUB_REPO_NAME),
dest_branch="master",
dest_user_email=GITHUB_EMAIL,
dest_user_name=GITLAB_USERNAME
)

1
jenkins/requirements.txt Normal file
View File

@@ -0,0 +1 @@
git+ssh://git@gitlab.gog.com/galaxy-client/github-exporter.git@v0.1