79 γραμμές
1,6 KiB
Text
79 γραμμές
1,6 KiB
Text
|
|
||
|
pipeline {
|
||
|
agent {
|
||
|
kubernetes {
|
||
|
yaml '''
|
||
|
apiVersion: v1
|
||
|
kind: Pod
|
||
|
spec:
|
||
|
containers:
|
||
|
- name: jnlp
|
||
|
image: 'jenkins/inbound-agent'
|
||
|
args: ['\$(JENKINS_SECRET)', '\$(JENKINS_NAME)']
|
||
|
- name: hugo
|
||
|
image: klakegg/hugo
|
||
|
command:
|
||
|
- sleep
|
||
|
args:
|
||
|
- 1d
|
||
|
- name: tea
|
||
|
image: 'tgerczei/tea'
|
||
|
command:
|
||
|
- sleep
|
||
|
args:
|
||
|
- 1d
|
||
|
'''
|
||
|
defaultContainer 'hugo'
|
||
|
}
|
||
|
}
|
||
|
|
||
|
options {
|
||
|
skipDefaultCheckout()
|
||
|
}
|
||
|
|
||
|
stages {
|
||
|
stage('Grab Code') {
|
||
|
container('hugo')
|
||
|
steps {
|
||
|
checkout scm
|
||
|
}
|
||
|
}
|
||
|
|
||
|
stage('Test Hugo syntax') {
|
||
|
container('hugo')
|
||
|
steps {
|
||
|
sh 'hugo --quiet'
|
||
|
}
|
||
|
}
|
||
|
|
||
|
stage('Build the Site') {
|
||
|
container('hugo')
|
||
|
steps {
|
||
|
sh 'hugo'
|
||
|
}
|
||
|
}
|
||
|
|
||
|
stage('Create Package') {
|
||
|
container('hugo')
|
||
|
steps {
|
||
|
sh "tar zcvf site.tar.gz ./public/"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
stage('Upload Release') {
|
||
|
container('tea')
|
||
|
environment {
|
||
|
GITEA_LOGIN = 'js-hellug-bot'
|
||
|
GITEA_SERVER_URL = 'https://dev.hellug.gr'
|
||
|
GITEA_SERVER_TOKEN = credentials('gitea-js-hellug-bot-token')
|
||
|
}
|
||
|
|
||
|
steps {
|
||
|
sh 'go get code.gitea.io/tea && go install code.gitea.io/tea'
|
||
|
sh "tea login add -n ${GITEA_LOGIN}"
|
||
|
sh 'tea r create -t ${BUILD_TAG} --tag ${BUILD_NUMBER} -a site.tar.gz'
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|