diff --git a/github-actions-demo.yml b/github-actions-demo.yml new file mode 100644 index 00000000..75be1014 --- /dev/null +++ b/github-actions-demo.yml @@ -0,0 +1,17 @@ +name: GitHub Actions Demo +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/jenkinsfile b/jenkinsfile new file mode 100644 index 00000000..7f14d39f --- /dev/null +++ b/jenkinsfile @@ -0,0 +1,26 @@ +pipeline{ +agent { + label 'slave1' +} +stages { + stage('Git Checkout') { + steps { + checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 'ubuntuId', url: 'https://github.com/JevitaD/simple-java-project']]]) + } + } + + stage('Build') { + steps { + sh 'cd /home/ubuntu/jenkins/workspace/PipelineProj/' + sh 'mvn clean install' + } + } + + stage('Deploy') { + steps { + sh 'sudo cp /home/ubuntu/jenkins/workspace/PipelineProj/target/*.war /opt/apache-tomcat-9.0.55/webapps' + } + } + + } +} diff --git a/pom.xml b/pom.xml index 19f98e41..948ff303 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,10 @@ test - + + 1.6 + 1.6 +