Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Update custom project workflow files (#3441)

Koenb5e84f1b83b6
diff --git a/.github/workflows/custom-deploy.yml b/.github/workflows/custom-deploy.yml
new file mode 100644
index 000000000..ee73b5966
--- /dev/null
+++ b/.github/workflows/custom-deploy.yml
@@ -0,0 +1,21 @@
+# Manual deployments for custom projects, must be called from a workflow_dispatch workflow
+name: Custom deploy
+
+on:
+ workflow_call:
+ inputs:
+ INPUTS:
+ type: string
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ deployment:
+ name: Deployment
+ uses: "./.github/workflows/deployment.yml"
+ with:
+ INPUTS: ${{ inputs.INPUTS }}
+ COMMIT: ${{ fromJSON(inputs.INPUTS || '{}').COMMIT }}
+ secrets: inherit
diff --git a/.github/workflows/custom-install-dist.yml b/.github/workflows/custom-install-dist.yml
new file mode 100644
index 000000000..20d8103da
--- /dev/null
+++ b/.github/workflows/custom-install-dist.yml
@@ -0,0 +1,28 @@
+name: Custom Install Dist
+
+on:
+ workflow_call:
+ inputs:
+ skip:
+ type: boolean
+ description: Skip condition to allow branch protection checks to pass
+ default: false
+
+jobs:
+ install-dist:
+ name: Install Dist
+ if: ${{ !inputs.skip }}
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+
+ - name: Set up JDK 21 and Gradle cache
+ uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
+ with:
+ distribution: "temurin"
+ java-version: "21"
+ cache: "gradle"
+
+ - name: Run Install Dist
+ timeout-minutes: 20
+ run: ./gradlew installDist
diff --git a/.github/workflows/custom-review.yml b/.github/workflows/custom-review.yml
index 1e14d9997..f5754c328 100644
--- a/.github/workflows/custom-review.yml
+++ b/.github/workflows/custom-review.yml
@@ -15,7 +15,7 @@ jobs:
name: Detect whether code changed
runs-on: ubuntu-latest
outputs: # See https://github.com/tj-actions/changed-files/tree/2bb135777322059ee3a3c9239999b159ff49febc#outputs-
- any_modified: ${{ steps.changed-files.outputs.backend_any_modified == 'true' || steps.changed-files.outputs.ui_any_modified == 'true' }}
+ any_modified: ${{ steps.changed-files.outputs.backend_any_modified == 'true' || steps.changed-files.outputs.ui_any_modified == 'true' || steps.changed-files.outputs.deployment_any_modified == 'true' }}
backend_any_modified: ${{ steps.changed-files.outputs.backend_any_modified }}
backend_spotless_any_modified: ${{ steps.changed-files.outputs.backend_spotless_any_modified }}
ui_any_modified: ${{ steps.changed-files.outputs.ui_any_modified }}
@@ -40,6 +40,9 @@ jobs:
- '!**/*.md'
- '!**/*.yml'
- '!yarn.lock'
+ deployment:
+ - 'deployment/**'
+ - '!**/*.md'
# Sources and configuration that spotlessBackendCheck reads
backend_spotless:
- '**/*.{gradle,groovy,java,md,tpl,xml,xsd,yaml,yml}'
@@ -76,7 +79,7 @@ jobs:
name: Build
needs: detect-changes
if: ${{ !failure() && !cancelled() }}
- uses: "./.github/workflows/install-dist.yml"
+ uses: "./.github/workflows/custom-install-dist.yml"
with:
skip: ${{ needs.detect-changes.outputs.any_modified != 'true' }}
diff --git a/.github/workflows/custom-staging.yml b/.github/workflows/custom-staging.yml
index cc9b139a6..f733108f9 100644
--- a/.github/workflows/custom-staging.yml
+++ b/.github/workflows/custom-staging.yml
@@ -20,6 +20,8 @@ jobs:
backend_spotless_any_modified: ${{ steps.changed-files.outputs.backend_spotless_any_modified }}
ui_any_modified: ${{ steps.changed-files.outputs.ui_any_modified }}
ui_spotless_any_modified: ${{ steps.changed-files.outputs.ui_spotless_any_modified }}
+ # Processed ci_cd.json outputs
+ deploys: ${{ steps.ci-cd-output.outputs.deploys }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
@@ -56,6 +58,23 @@ jobs:
- 'ui/**/*.{cjs,css,cts,gradle,html,js,json,jsonc,jsx,md,mdx,mjs,mts,ts,tsx}'
- 'ui/.prettierignore'
+ - name: Get version details
+ id: get-version-details
+ uses: openremote/core/.github/actions/get-version-details@3cde448ab3d2e825e7ab189881d0e6cf33a34486
+
+ - name: Check if core repo
+ id: is_core_repo
+ uses: openremote/core/.github/actions/check-if-core-repo@357f1387fbc99e7a59752a62064f0bdade57612d
+
+ - name: Process ci_cd.json file
+ id: ci-cd-output
+ uses: openremote/core/.github/actions/process-cicd-json@357f1387fbc99e7a59752a62064f0bdade57612d
+ with:
+ IS_CORE_REPO: ${{ steps.is_core_repo.outputs.value }}
+ MANAGER_VERSION: ${{ steps.is_core_repo.outputs.version }}
+ IS_RELEASE: ${{ steps.get-version-details.outputs.is_release }}
+ VERSION: ${{ steps.get-version-details.outputs.version }}
+
check-spotless:
name: Lint
needs: detect-changes
@@ -75,7 +94,7 @@ jobs:
install-dist:
name: Build
needs: detect-changes
- uses: "./.github/workflows/install-dist.yml"
+ uses: "./.github/workflows/custom-install-dist.yml"
unit-tests:
name: Test
@@ -101,7 +120,11 @@ jobs:
# with:
# skip: ${{ needs.detect-changes.outputs.backend_any_modified != 'true' }}
- # deployment:
- # name: Deploy
- # needs: [unit-tests, integration-tests]
- # uses: "./.github/workflows/deployment.yml"
+ deployment:
+ name: Deploy
+ needs: [detect-changes, check-spotless, ui-check-spotless, install-dist, unit-tests, integration-tests]
+ if: ${{ !failure() && !cancelled() && needs.detect-changes.outputs.deploys != '' }}
+ uses: "./.github/workflows/deployment.yml"
+ with:
+ INPUTS: ${{ inputs.INPUTS }}
+ secrets: inherit
diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml
index f03d6c7ef..ac9c3e59d 100644
--- a/.github/workflows/deployment.yml
+++ b/.github/workflows/deployment.yml
@@ -36,6 +36,11 @@ jobs:
sparse-checkout: .ci_cd
sparse-checkout-cone-mode: false
+ # Compatibility with released scripts
+ - name: Provide legacy core repo checkout path
+ if: ${{ steps.is_core_repo.outputs.value == 'false' }}
+ run: ln -s core openremote
+
- name: Process ci_cd.json file
id: ci-cd-output
uses: openremote/core/.github/actions/process-cicd-json@357f1387fbc99e7a59752a62064f0bdade57612d
@@ -325,6 +330,7 @@ jobs:
sys.exit(1)
env:
IS_CORE_REPO: ${{ steps.is_core_repo.outputs.value }}
+ IS_MAIN_REPO: ${{ steps.is_core_repo.outputs.value }} # Compatibility with released scripts
DEPLOYMENTS: ${{ steps.deployments.outputs.value }}
BUILDX_BUILDER: ${{ steps.buildx.outputs.name }}
MANAGER_DOCKER_BUILD_PATH: manager/build/install/manager