diff --git a/Jenkinsfile b/Jenkinsfile index f34dafe..b4b5982 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,40 +1,35 @@ #!groovy pipeline { - agent none - + agent { + label 'linux' + } + when { + beforeAgent true; + branch 'main' + } stages { - stage('Compile List and Push to Gitea') { - when { - beforeAgent true; - branch 'main' + stage('NPM Install') { + steps { + sh 'npm clean-install' } - agent { - label 'linux' + } + stage('Compile Adblock List') { + steps { + sh 'npm run compile' } - stages { - stage('NPM Install') { - steps { - sh 'npm clean-install' - } - } - stage('Compile Adblock List') { - steps { - sh 'npm run compile' - } - } - stage('git push') { - steps { - withCredentials([ - gitUsernamePassword(credentialsId: 'gitea-jenkins-user-token') - ]) { - sh ''' - git add . - git commit -m "Update Compiled Adblock List" - git push - ''' - } - } + } + stage('git push') { + steps { + withCredentials([ + gitUsernamePassword(credentialsId: 'gitea-jenkins-user-token') + ]) { + sh ''' + git checkout main + git add . + git commit -m "Update Compiled Adblock List" + git push + ''' } } }