From 57ad2c0b3dda79f9ee1df92486e6a81ddadf08ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Enrique=20Colina=20Rodr=C3=ADguez?= Date: Tue, 15 Oct 2024 20:56:17 +0200 Subject: [PATCH] chore: Automate CLI Version Update for Agile Releases (#30276) (#30346) ### Proposed Changes * A new job is included in the dotCLI GitHub Actions workflow example that calculates the latest available version of the dotcli runner. This ensures we always point to the most recent version of the jar without hardcoding any particular version. ### Additional Info Related to #30276 (Automate CLI Version Update for Agile Releases). --- .../action/.github/workflows/main.yml | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/tools/dotcms-cli/action/.github/workflows/main.yml b/tools/dotcms-cli/action/.github/workflows/main.yml index 3904822dae50..ddcdb4b7fd50 100644 --- a/tools/dotcms-cli/action/.github/workflows/main.yml +++ b/tools/dotcms-cli/action/.github/workflows/main.yml @@ -3,7 +3,33 @@ name: dotCMS sync on: [push] jobs: + + dotcli-runner: + runs-on: ubuntu-latest + outputs: + url: ${{ steps.dotcli-runner.outputs.url }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install xmllint + run: sudo apt-get update && sudo apt-get install -y libxml2-utils + + - name: Get dotCLI runner + id: dotcli-runner + run: | + echo "::group::Get dotCLI runner" + + curl -o maven-metadata.xml "https://repo.dotcms.com/artifactory/libs-release-local/com/dotcms/dotcms-cli/maven-metadata.xml" + LATEST_VERSION=$(xmllint --xpath "string(//versioning/latest)" maven-metadata.xml) + URL="https://repo.dotcms.com/artifactory/libs-release-local/com/dotcms/dotcms-cli/${LATEST_VERSION}/dotcms-cli-${LATEST_VERSION}-runner.jar" + + echo "::notice::DOTCLI RUNNER: $URL" + echo "url=$URL" >> "$GITHUB_OUTPUT" + echo "::endgroup::" + sync-with-dotcms: + needs: dotcli-runner runs-on: ubuntu-latest env: # Global environment expected by dotCMS CLI @@ -15,15 +41,12 @@ jobs: # This is how we instruct the cli to create the workspace if it does not exist DOT_CREATE_WORKSPACE: ${{ vars.DOT_CREATE_WORKSPACE || 'true' }} # This is the CLI version to use, but we can always override this value - DOT_CLI_JAR_DOWNLOAD_URL: ${{ vars.DOT_CLI_JAR_DOWNLOAD_URL || 'https://repo.dotcms.com/artifactory/libs-release-local/com/dotcms/dotcms-cli/24.10.02/dotcms-cli-24.10.02-runner.jar' }} + DOT_CLI_JAR_DOWNLOAD_URL: ${{ vars.DOT_CLI_JAR_DOWNLOAD_URL || needs.dotcli-runner.outputs.url }} # In case we want to force the download of the CLI jar DOT_FORCE_DOWNLOAD: ${{ vars.DOT_FORCE_DOWNLOAD || 'false' }} steps: - name: Checkout uses: actions/checkout@v4 - id: checkout - with: - fetch-depth: 0 - name: Load .env file uses: aarcangeli/load-dotenv@v1.0.0