diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..6e94abc --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,36 @@ +name: Java CI with Maven + +on: [push, pull_request] +env: + SONATYPE_LIFECYCLE_APPLICATION_ID: $(echo "${{ github.repository }}" | cut -d '/' -f2) + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + + - uses: actions/checkout@master + with: + name: OWASP-Benchmark/BenchmarkJava + ref: refs/heads/release + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'zulu' + - name: Run Spotless check + run: mvn spotless:check + - name: Create WAR + run: mvn package + - name: Sonatype Lifecycle Policy Evaluation + uses: sonatype-nexus-community/iq-github-action@v2 + with: + serverUrl: ${{ secrets.SONATYPE_LIFECYCLE_URL }} + username: ${{ secrets.SONATYPE_LIFECYCLE_USERNAME }} + password: ${{ secrets.SONATYPE_LIFECYCLE_PASSWORD }} + applicationId: ${{ env.SONATYPE_LIFECYCLE_APPLICATION_ID }} + stage: Build + target: ./target/ + \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..389f34b --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,24 @@ +pipeline { + agent { + label 'maven-node' + } + stages { + stage('Pull Source') { + // Get some code from a GitHub repository + steps { + git url: 'https://github.com/OWASP-Benchmark/BenchmarkJava.git' + } + } + stage('Build & Install') { + steps { + echo "Performing maven build" + sh 'mvn clean install' + } + } + stage('Nexus Lifecycle Evaluation') { + steps { + nexusPolicyEvaluation failBuildOnNetworkError: false, iqApplication: "${env.JOB_BASE_NAME}", iqStage: 'build', jobCredentialsId: '' + } + } + } +} \ No newline at end of file