From 78d12b0d12e133ab1ca42cd59265427631a3c315 Mon Sep 17 00:00:00 2001 From: infl00p Date: Tue, 14 Sep 2021 16:06:12 +0300 Subject: [PATCH] Pipeline support --- Jenkinsfile | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..d097a73 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,78 @@ + +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' + } + } + } +}