This repository has been archived on 2024-08-07. You can view files and clone it, but cannot push or open issues or pull requests.
Andreas Fahrecker e72ecc35a2
All checks were successful
andreas-personal/AndysAdguardHomeBlockList/pipeline/head This commit looks good
test
2024-04-10 17:44:44 +02:00

80 lines
2.1 KiB
Groovy

#!groovy
pipeline {
agent {
label 'linux'
}
stages {
stage('Checkout') {
when {
beforeAgent true;
branch 'main'
}
steps {
sh 'git checkout main'
}
}
stage('Check last Commit') {
when {
beforeAgent true;
branch 'main'
}
steps {
script {
// Replace 'Jenkins' with the name Jenkins uses to commit
if (sh(script: 'git log -1 --pretty=format:"%an"', returnStdout: true).trim() == 'Jenkins') {
currentBuild.result = 'ABORTED'
error('Last commit was by Jenkins, skipping build')
} else {
echo 'Last commit was not by Jenkins, continuing build'
}
}
}
}
stage('NPM Install') {
when {
beforeAgent true;
branch 'main'
}
steps {
sh 'npm clean-install'
}
}
stage('Compile Adblock List') {
when {
beforeAgent true;
branch 'main'
}
steps {
sh 'mkdir -p out'
sh 'npm run compile:test'
sh '''
git add out/andysadguardhomeblocklist.txt
git commit -m "Update Compiled Adblock List"
'''
}
}
stage('git push') {
when {
beforeAgent true;
branch 'main'
}
steps {
withCredentials([
gitUsernamePassword(credentialsId: 'gitea-jenkins-user-token')
]) {
sh '''
git pull origin main
git push
'''
}
}
}
}
post {
always {
deleteDir()
}
}
}