Skip to content

#TESTING-DOTCLI Update. +6 #6

#TESTING-DOTCLI Update. +6

#TESTING-DOTCLI Update. +6 #6

Workflow file for this run

name: dotCMS sync
on: [push]
jobs:
dotcms-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
env:
DOT_CLI_JAR_DOWNLOAD_URL: ${{ vars.DOT_CLI_JAR_DOWNLOAD_URL }}
run: |
echo "::group::Get dotCLI runner"
if [ -z "$DOT_CLI_JAR_DOWNLOAD_URL" ]; then
curl -o -s 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"
MESSAGE="var.DOT_CLI_JAR_DOWNLOAD_URL is not set, fetching dotCLI runner from "$URL"
else
URL="$DOT_CLI_JAR_DOWNLOAD_URL"
MESSAGE="var.DOT_CLI_JAR_DOWNLOAD_URL is set, fetching dotCLI runner from $URL"
fi
echo "$MESSAGE"
echo "url=$URL" >> "$GITHUB_OUTPUT"
echo "::endgroup::"
sync-with-dotcms:
needs: dotcms-runner
runs-on: ubuntu-latest
env:
# Global environment expected by dotCMS CLI
# This is how we instruct the cli the target server
DOT_API_URL: ${{ vars.DOT_API_URL }}
# This is how we instruct the cli the target folder in the repo
# By default it must be the root of the repo this allows setting up a different folder on top of the root
DOT_REPO_BASE_PATH: ${{ vars.DOT_REPO_BASE_PATH }}
# 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: ${{ 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: Print context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"