diff --git a/.github/workflows/build.yml b/.github/workflows/_build.yml similarity index 98% rename from .github/workflows/build.yml rename to .github/workflows/_build.yml index a658d7285..c94ea2fae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/_build.yml @@ -1,7 +1,7 @@ name: Tests on: - - push + workflow_call: jobs: build: diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/_checkstyle.yml similarity index 96% rename from .github/workflows/checkstyle.yml rename to .github/workflows/_checkstyle.yml index 0820490b3..1942a07c0 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/_checkstyle.yml @@ -1,7 +1,7 @@ name: Check Style on: - - push + workflow_call: jobs: check-style: diff --git a/.github/workflows/codeql.yml b/.github/workflows/_codeql.yml similarity index 95% rename from .github/workflows/codeql.yml rename to .github/workflows/_codeql.yml index 8eb3f42b6..355ae256d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/_codeql.yml @@ -12,11 +12,7 @@ name: "CodeQL" on: - push: - branches: [ "main" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "main" ] + workflow_call: schedule: - cron: '33 17 * * 1' diff --git a/.github/workflows/docs.yml b/.github/workflows/_docs.yml similarity index 93% rename from .github/workflows/docs.yml rename to .github/workflows/_docs.yml index d14106f47..8d0631ac4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/_docs.yml @@ -1,10 +1,7 @@ name: Publish Documentation on: - release: - types: [ published ] - - # Allows running this workflow manually from the Actions tab + workflow_call: workflow_dispatch: jobs: diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/_integration-tests.yml similarity index 94% rename from .github/workflows/integration-tests.yml rename to .github/workflows/_integration-tests.yml index 5eb3fd97b..2a0a85c49 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/_integration-tests.yml @@ -1,9 +1,7 @@ name: Integration Tests on: - pull_request: - schedule: - - cron: '0 23 * * *' + workflow_call: workflow_dispatch: jobs: integration_tests: diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/_maven-publish.yml similarity index 92% rename from .github/workflows/maven-publish.yml rename to .github/workflows/_maven-publish.yml index 2d4137ba6..f2b55a9b4 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/_maven-publish.yml @@ -1,10 +1,7 @@ name: Publish package to the Maven Central Repository on: - release: - types: [ published ] - - # Allows running this workflow manually from the Actions tab + workflow_call: workflow_dispatch: jobs: diff --git a/.github/workflows/sync-md.yml b/.github/workflows/_sync-md.yml similarity index 82% rename from .github/workflows/sync-md.yml rename to .github/workflows/_sync-md.yml index b6f2ee0b4..4ace2939d 100644 --- a/.github/workflows/sync-md.yml +++ b/.github/workflows/_sync-md.yml @@ -1,10 +1,7 @@ name: Sync `documentation` directory to ReadMe -# Run workflow for every push to the `main` branch on: - release: - branches: - - main + workflow_call: workflow_dispatch: jobs: diff --git a/.github/workflows/test-code-samples.yml b/.github/workflows/_test-code-samples.yml similarity index 88% rename from .github/workflows/test-code-samples.yml rename to .github/workflows/_test-code-samples.yml index 1019cab72..c06ba1a31 100644 --- a/.github/workflows/test-code-samples.yml +++ b/.github/workflows/_test-code-samples.yml @@ -1,10 +1,6 @@ name: Test Samples Java Classes on: - pull_request: - schedule: - - cron: '0 23 * * *' - - # Allows to run this workflow manually from the Actions tab + workflow_call: workflow_dispatch: jobs: diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 000000000..b78f16feb --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,11 @@ +name: Publish Release + +on: + release: + types: [ published ] + +jobs: + docs-publish: + uses: mindee/mindee-api-java/.github/workflows/_docs.yml@main + maven-publish: + uses: mindee/mindee-api-java/.github/workflows/_maven-publish.yml@main diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 000000000..c9590fd53 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,20 @@ +name: Pull Requests + +on: + pull_request: + +jobs: + checkstyle: + uses: mindee/mindee-api-java/.github/workflows/_checkstyle.yml + build: + uses: mindee/mindee-api-java/.github/workflows/_build.yml + needs: checkstyle + codeql: + uses: mindee/mindee-api-java/.github/workflows/_codeql.yml + needs: build + integration_tests: + uses: mindee/mindee-api-java/.github/workflows/_integration-tests.yml + needs: build + test_code_samples: + uses: mindee/mindee-api-java/.github/workflows/_test-code-samples.yml + needs: build diff --git a/.github/workflows/tag-main-branch.yml b/.github/workflows/tag-main-branch.yml new file mode 100644 index 000000000..26c5f8b81 --- /dev/null +++ b/.github/workflows/tag-main-branch.yml @@ -0,0 +1,22 @@ +name: Tag Main Branch + +on: + push: + branches: + - main + +jobs: + checkstyle: + uses: mindee/mindee-api-java/.github/workflows/_checkstyle.yml@main + build: + uses: mindee/mindee-api-java/.github/workflows/_build.yml@main + needs: checkstyle + codeql: + uses: mindee/mindee-api-java/.github/workflows/codeql.yml@main + needs: build + sync-readme: + uses: mindee/mindee-api-java/.github/workflows/_sync-md.yml@main + needs: build + tag: + uses: mindee/client-lib-actions/.github/workflows/tag-version.yml@main + needs: codeql diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml deleted file mode 100644 index 5047743e1..000000000 --- a/.github/workflows/tag-version.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Tag Version - -on: - push: - branches: - - main - -jobs: - tag-version: - runs-on: ubuntu-latest - if: "contains(github.event.head_commit.message, ':bookmark:')" - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - - name: Tag version - run: | - msg_start=':bookmark: Version ' - version_format='[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}' - version=$(git log -1 --skip=0 --pretty=%s | grep -oP "(?<=${msg_start})${version_format}") - - if [ -z "${version}" ]; then - echo 'Version not found, aborting.' - exit 1 - fi - - echo "Found version: ${version}"; - tag="v${version}"; - - echo "Would tag: ${tag}"; - existing_tag=$(git tag -l "${tag}"); - - if [ "${existing_tag}" ]; then - echo "Tag '${existing_tag}' already exists, aborting."; - exit 1; - fi - - git config user.name "Mindee"; - git config user.email "opensource@mindee.com" - - git tag -a "${tag}" -m"Version ${version}"; - git push origin "${tag}" - - echo "Tagged and pushed: ${tag}"