diff --git a/.github/workflows/_reusable_build.yml b/.github/workflows/_reusable_build.yml new file mode 100644 index 0000000..5d3cfa3 --- /dev/null +++ b/.github/workflows/_reusable_build.yml @@ -0,0 +1,54 @@ +name: Resuable Build + +on: + workflow_call: + inputs: + ref: + type: string + default: ${{ github.ref }} + description: The branch ref to build. Leave empty to use workflow branch. + publish: + type: boolean + default: false + description: To publish the project artifacts to the Maven alternative repository. + alt-deployment-repository: + type: string + default: snapshots::${{ vars.SNAPSHOTS_REPOSITORY_URL }} + description: Maven alternative repository to which the project artifacts should be deployed. + + secrets: + BONITA_CI_PAT: + required: true + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + repository: bonitasoft/bonita-application-directory + token: ${{ secrets.BONITA_CI_PAT }} + ref: ${{ inputs.ref }} + + - name: ☕ Set up Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 11 + cache: maven + + - name: Configure Maven Settings + uses: bonitasoft/maven-settings-action@v1 + with: + keeper-secret-config: ${{ secrets.KSM_CONFIG }} + + - name: Maven Build + if: ${{ !inputs.publish }} + timeout-minutes: 60 + run: ./mvnw -ntp verify + + - name: Maven Build & Deploy + if: ${{ inputs.publish }} + timeout-minutes: 60 + run: ./mvnw -ntp deploy -DaltDeploymentRepository=${{ inputs.alt-deployment-repository }} diff --git a/.github/workflows/all_check_passed.yml b/.github/workflows/all_check_passed.yml new file mode 100644 index 0000000..9f3a826 --- /dev/null +++ b/.github/workflows/all_check_passed.yml @@ -0,0 +1,11 @@ +name: All checks pass + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + allchecks: + runs-on: ubuntu-latest + steps: + - uses: wechuli/allcheckspassed@v1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f7c8e6e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,21 @@ +name: Build + +on: + push: + branches: + - "[0-9]+.[0-9]+.x" + - "master" + - "release-*" + - "dev" + paths-ignore: + - ".github/**" + - "**/README.md" + - "!.github/workflows/build.yml" + - "!.github/workflows/_reusable_build.yml" + +jobs: + build: + uses: ./.github/workflows/_reusable_build.yml + with: + publish: true + secrets: inherit diff --git a/.github/workflows/build_pr.yml b/.github/workflows/build_pr.yml new file mode 100644 index 0000000..799d98d --- /dev/null +++ b/.github/workflows/build_pr.yml @@ -0,0 +1,20 @@ +name: Build Pull Request + +on: + pull_request: + paths-ignore: + - ".github/**" + - "**/README.md" + - "!.github/workflows/build_pr.yml" + - "!.github/workflows/_reusable_build.yml" + +jobs: + build-pr: + if: | + startsWith(github.head_ref, '7.14.x') != 'true' || + startsWith(github.head_ref, '7.15.x') != 'true' || + startsWith(github.head_ref, '8.0.x') != 'true' || + startsWith(github.head_ref, 'master') != 'true' || + startsWith(github.head_ref, 'release-') != 'true' + uses: ./.github/workflows/_reusable_build.yml + secrets: inherit diff --git a/.github/workflows/create_merge_pr_upstream.yml b/.github/workflows/create_merge_pr_upstream.yml new file mode 100644 index 0000000..fcaac2e --- /dev/null +++ b/.github/workflows/create_merge_pr_upstream.yml @@ -0,0 +1,16 @@ +name: Create Merge Pull Request Upstream + +on: + workflow_dispatch: + push: + branches: + - "[0-9]+.[0-9]+.x" + - "master" + - "release-*" + +jobs: + create-merge-pr: + uses: bonitasoft/github-workflows/.github/workflows/_reusable_create_merge_pr.yml@main + secrets: inherit + with: + labels: automerge diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 35796a0..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,29 +0,0 @@ - -properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '5']]]) - -timestamps { - ansiColor('xterm') { - node { - stage('Setup') { - checkout scm - } - - stage('Build') { - try { - def currentBranch = env.BRANCH_NAME - def isBaseBranch = currentBranch == 'master' || currentBranch == 'dev' || currentBranch?.startsWith('release-') || currentBranch?.matches('7\\..+\\.x') - configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) { - if(!isBaseBranch){ - sh "./mvnw -s ${MAVEN_SETTINGS} --no-transfer-progress -B clean verify -Djvm=${env.JAVA_HOME_11}/bin/java" - }else{ - sh "./mvnw -s ${MAVEN_SETTINGS} --no-transfer-progress -B clean deploy -Djvm=${env.JAVA_HOME_11}/bin/java -DaltDeploymentRepository=${env.ALT_DEPLOYMENT_REPOSITORY_SNAPSHOTS}" - } - } - archiveArtifacts '**/target/bonita-application-directory-*.bos' - } finally { - junit allowEmptyResults : true, testResults: '**/target/surefire-reports/*.xml' - } - } - } - } -} diff --git a/pom.xml b/pom.xml index 69c2a4e..73ecd09 100644 --- a/pom.xml +++ b/pom.xml @@ -54,6 +54,10 @@ + + maven-deploy-plugin + 3.1.1 + maven-assembly-plugin 3.3.0