diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..037f7ef --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,32 @@ +version: 2 +updates: + + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + target-branch: dev + schedule: + interval: "daily" + commit-message: + prefix: "chore" + include: "scope" + groups: + production-dependencies: + dependency-type: "production" + development-dependencies: + dependency-type: "development" + + # Maintain dependencies for maven + - package-ecosystem: "maven" + directory: "/" + target-branch: dev + schedule: + interval: "daily" + commit-message: + prefix: "chore" + include: "scope" + groups: + production-dependencies: + dependency-type: "production" + development-dependencies: + dependency-type: "development" \ No newline at end of file diff --git a/.github/workflows/_reusable_build.yml b/.github/workflows/_reusable_build.yml new file mode 100644 index 0000000..462b250 --- /dev/null +++ b/.github/workflows/_reusable_build.yml @@ -0,0 +1,66 @@ +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 on Bonita Artifact Repository. + release: + type: boolean + default: false + description: To indicate that the current build is for a release (it will publish artifacts as well). + + secrets: + BONITA_CI_PAT: + required: true + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + repository: bonitasoft/bonita-admin-application + 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 snapshot + if: ${{ inputs.publish && !inputs.release }} + timeout-minutes: 60 + run: ./mvnw -ntp deploy -DaltDeploymentRepository=snapshots::${{ vars.SNAPSHOTS_REPOSITORY_URL }} + + - name: Maven Build & Deploy release + if: ${{ inputs.release }} + timeout-minutes: 60 + # Profile release is used to sign artifacts with GPG + run: ./mvnw -ntp deploy -Prelease -DaltDeploymentRepository=staging::${{ vars.STAGING_REPOSITORY_URL }} + + - name: Upload BOS to the Github release + if: ${{ inputs.release }} + env: + GH_TOKEN: ${{ secrets.BONITA_CI_PAT }} + run: gh release upload ${{ inputs.ref }} ./target/bonita-admin-application-${{ inputs.ref }}.bos diff --git a/.github/workflows/_reusable_tag.yml b/.github/workflows/_reusable_tag.yml new file mode 100644 index 0000000..e36a7b8 --- /dev/null +++ b/.github/workflows/_reusable_tag.yml @@ -0,0 +1,49 @@ +name: Create Tag + +on: + workflow_call: + inputs: + version: + required: true + type: string + secrets: + BONITA_CI_PAT: + required: true + KSM_CONFIG: + required: true + +jobs: + create_tag: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + repository: bonitasoft/bonita-admin-application + token: ${{ secrets.BONITA_CI_PAT }} + + - name: Git Setup + uses: bonitasoft/git-setup-action@v1 + with: + keeper-secret-config: ${{ secrets.KSM_CONFIG }} + + - name: Create Release Branch + run: git checkout -B release/${{ inputs.version }} + + - name: Change Version + run: ./mvnw versions:set -DnewVersion=${{ inputs.version }} + + - name: Commit and Push Tag + run: | + git commit -a -m "release(${{ inputs.version }}) create release ${{ inputs.version }}" + git tag -a ${{ inputs.version }} -m "Release ${{ inputs.version }}" + git push origin ${{ inputs.version }}:${{ inputs.version }} + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.BONITA_CI_PAT }} + with: + tag_name: ${{ inputs.version }} + release_name: Release ${{ inputs.version }} diff --git a/.github/workflows/_reusable_update_version.yml b/.github/workflows/_reusable_update_version.yml new file mode 100644 index 0000000..68c6f81 --- /dev/null +++ b/.github/workflows/_reusable_update_version.yml @@ -0,0 +1,48 @@ +name: Update Version + +on: + workflow_call: + inputs: + version: + type: string + required: true + secrets: + KSM_CONFIG: + required: true + BONITA_CI_PAT: + required: true + +jobs: + update-version: + runs-on: ubuntu-22.04 + steps: + + - uses: actions/checkout@v4 + with: + repository: bonitasoft/bonita-admin-application + ref: ${{ github.ref }} + token: ${{ secrets.BONITA_CI_PAT }} + + - name: Setup Java + uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: 'temurin' + + - name: Setup Maven + uses: bonitasoft/maven-settings-action@v1 + with: + keeper-secret-config: ${{ secrets.KSM_CONFIG }} + + - name: Update version + run: ./mvnw -B -ntp versions:set -DnewVersion=${{ inputs.version }} + + - name: Git Setup + uses: bonitasoft/git-setup-action@v1 + with: + keeper-secret-config: ${{ secrets.KSM_CONFIG }} + + - name: Commit and push + run: | + git commit -a -m "chore(versioning): update version to ${{ inputs.version }}" + git push \ No newline at end of file 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..9e9974b --- /dev/null +++ b/.github/workflows/build_pr.yml @@ -0,0 +1,15 @@ +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: contains(fromJson(vars.SUPPORTED_BRANCHES).all-branches, github.head_ref) != true + uses: ./.github/workflows/_reusable_build.yml + secrets: inherit diff --git a/.github/workflows/merge_upstream.yml b/.github/workflows/merge_upstream.yml new file mode 100644 index 0000000..ebd74c7 --- /dev/null +++ b/.github/workflows/merge_upstream.yml @@ -0,0 +1,14 @@ +name: Merge Upstream + +on: + workflow_dispatch: + push: + branches: + - "[0-9]+.[0-9]+.x" + - "master" + - "release-*" + +jobs: + merge-upstream: + uses: bonitasoft/github-workflows/.github/workflows/_reusable_merge_upstream.yml@main + secrets: inherit diff --git a/.gitignore b/.gitignore index b01f589..b9d50d8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,6 @@ target/ .project .idea *.iml -.flattened-pom.xml \ No newline at end of file + +.flattened-pom.xml +pom.xml.versionsBackup diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index eb17bb8..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,41 +0,0 @@ -pipeline { - agent any - options { - timestamps() - ansiColor('xterm') - buildDiscarder(logRotator(numToKeepStr: '3')) - } - environment { - JAVA_HOME = "${env.JAVA_HOME_17}" - JAVA_TOOL_OPTIONS = '' - MAVEN_OPTS = '-Dstyle.color=always -Djansi.passthrough=true' - } - stages { - stage('Build') { - steps { - configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) { - script { - try { - sh("./mvnw -s $MAVEN_SETTINGS --no-transfer-progress verify") - } finally { - archiveArtifacts artifacts: '**/target/bonita-admin-application-*.bos' - } - } - } - } - } - stage('Deploy') { - when { - expression { return env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME?.startsWith('release-') || env.BRANCH_NAME?.matches('9\\..+\\.x') } - } - steps { - configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) { - // On artifactory (private) - sh("./mvnw -s $MAVEN_SETTINGS --no-transfer-progress deploy -DaltDeploymentRepository=${env.ALT_DEPLOYMENT_REPOSITORY_SNAPSHOTS}") - // Community admin app on ossrh snapshots (public) - sh("./mvnw -s $MAVEN_SETTINGS -f community --no-transfer-progress deploy -Possrh") - } - } - } - } -} diff --git a/community/pom.xml b/community/pom.xml index 1bac713..d4ceb53 100644 --- a/community/pom.xml +++ b/community/pom.xml @@ -46,6 +46,7 @@ 3.3.1 3.6.0 3.6.0 + 3.1.2 3.4.0 1.6.13 3.1.0 @@ -194,6 +195,10 @@ maven-dependency-plugin ${maven-dependency-plugin.version} + + + maven-deploy-plugin + ${maven-deploy-plugin.version} maven-resources-plugin