-
-
Notifications
You must be signed in to change notification settings - Fork 510
/
Jenkinsfile
92 lines (83 loc) · 2.81 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env groovy
def docsOutDir = 'build/docsOut'
def gitSshCredentialsId = 'crt_git_ssh_key'
def botUsername = 'crafttweakerbot'
def documentationDir = 'CrafttweakerDocumentation'
def exportDirInRepo = 'docs_exported/1.18/botania'
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
}
agent any
tools {
jdk "jdk-17.0.1"
}
stages {
stage('Clean') {
steps {
echo 'Cleaning Project'
sh 'chmod +x gradlew'
sh './gradlew clean --no-daemon'
}
}
stage('Build and Deploy Release') {
when {
tag 'release-*'
}
environment {
RELEASE_MODE = '1'
}
steps {
sh './gradlew build publish --no-daemon'
}
}
stage('Build and Deploy Snapshot') {
when {
not {
tag 'release-*'
}
}
steps {
sh './gradlew build publish --no-daemon'
}
}
/*
stage('Update CraftTweaker Docs') {
when {
tag 'release-*'
}
steps {
echo "Cloning Repository at Branch main"
dir(documentationDir) {
git credentialsId: gitSshCredentialsId, url: docsRepositoryUrl, branch: "main", changelog: false
}
echo "Clearing existing Documentation export"
dir(documentationDir) {
sh "rm --recursive --force ./$exportDirInRepo"
}
echo "Moving Generated Documentation to Local Clone"
sh "mkdir --parents ./$documentationDir/$exportDirInRepo"
sh "mv ./$docsOutDir/* ./$documentationDir/$exportDirInRepo/"
echo "Committing and Pushing to the repository"
dir(documentationDir) {
sshagent([gitSshCredentialsId]) {
sh "git config user.name $botUsername"
sh "git config user.email $botEmail"
sh 'git add -A'
//Either nothing to commit, or we create a commit
sh "git diff-index --quiet HEAD || git commit -m 'CI Doc export for Botania build ${env.BRANCH_NAME}-${env.BUILD_NUMBER}\n\nMatches git commit ${env.GIT_COMMIT}'"
sh "git push origin main"
}
}
}
}
*/
}
post {
always {
archiveArtifacts artifacts: 'Forge/build/libs/*.jar, Fabric/build/libs/*.jar'
}
}
}