Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ runs:
- name: Set up QEMU
uses: docker/[email protected]
with:
image: tonistiigi/binfmt:latest
image: tonistiigi/binfmt:qemu-v7.0.0
platforms: ${{ inputs.docker_platforms }}

- name: Docker Metadata
Expand Down Expand Up @@ -191,4 +191,4 @@ runs:
push: ${{ inputs.do_deploy }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: ${{ inputs.build_args }}
build-args: ${{ inputs.build_args }}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Note: The versions of the SDK libraries will be incremented in the NPM registry,
# but they will not be updated in the codebase itself through this process.
# This simplification avoids automatic pull requests and all the considerations
# necessary due to protections on the main branch, as well as the lengthy execution
# Note: The versions of the SDK libraries will be incremented in the NPM registry,
# but they will not be updated in the codebase itself through this process.
# This simplification avoids automatic pull requests and all the considerations
# necessary due to protections on the main branch, as well as the lengthy execution
# process that would be required to ultimately publish the libraries.
#
# This is a temporary solution until we determine the most appropriate pattern
# to handle the lifecycle of each module that needs to be released individually
#
# This is a temporary solution until we determine the most appropriate pattern
# to handle the lifecycle of each module that needs to be released individually
# (e.g., dotCLI and the SDKs).
#
# Additionally, the example projects should point to the 'latest' tag to ensure
# Additionally, the example projects should point to the 'next' tag to ensure
# that version updates do not impact their functionality due to version inconsistency.
name: 'SDK Publish NPM Packages'
description: 'Publish the dotCMS SDK libs on NPM registry.'
Expand All @@ -23,10 +23,10 @@ inputs:
npm-package-tag:
description: 'Package tag'
required: false
default: 'alpha'
default: 'beta'
github-token:
description: 'GitHub Token'
required: true
required: true
outputs:
npm-package-version:
description: 'SDK libs - NPM package version'
Expand Down Expand Up @@ -62,33 +62,40 @@ runs:
ls -R $BASE_PATH
echo "PATH=$PATH:${BASE_PATH}/node/:${BASE_PATH}/node/yarn/dist/bin" >> $GITHUB_ENV
echo "::endgroup::"
shell: bash
shell: bash

- name: 'Get current version from NPM'
id: current_version
run: |
echo "::group::Get current version"
CURRENT_VERSION=$(npm view @dotcms/client dist-tags --json | jq -r '.alpha')
echo "Current version: $CURRENT_VERSION"
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "::endgroup::"
echo "::group::Get current version"
# This should be empty on the first run. Setting the NEXT_VERSION to 0.0.1-beta.1
CURRENT_VERSION=$(npm view @dotcms/client dist-tags --json | jq -r '.beta')

if [ -z "$CURRENT_VERSION" ] || [ "$CURRENT_VERSION" = "null" ]; then
CURRENT_VERSION="0.0.1-beta.0"
fi

echo "Current version: $CURRENT_VERSION"
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "::endgroup::"
shell: bash

- name: 'Calculate next version'
id: next_version
env:
CURRENT_VERSION: ${{ steps.current_version.outputs.current_version }}
run: |
echo "::group::Calculate next version"
VERSION_PARTS=(${CURRENT_VERSION//./ })
BASE_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}"
ALPHA_PART=${VERSION_PARTS[3]#*-}
ALPHA_NUMBER=${ALPHA_PART#*.}
NEW_ALPHA_NUMBER=$((ALPHA_NUMBER + 1))
NEXT_VERSION="${BASE_VERSION}.${NEW_ALPHA_NUMBER}"
echo "Next version: $NEXT_VERSION"
echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT
echo "::endgroup::"
echo "::group::Calculate next version"
VERSION_PARTS=(${CURRENT_VERSION//./ })
BASE_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}"
BETA_PART=${VERSION_PARTS[3]#*-}
BETA_NUMBER=${BETA_PART#*.}
NEW_BETA_NUMBER=$((BETA_NUMBER + 1))
NEXT_VERSION="${BASE_VERSION}.${NEW_BETA_NUMBER}"
echo "Next version: $NEXT_VERSION"
echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT
echo "::endgroup::"

shell: bash

- name: 'Printing versions'
Expand All @@ -110,27 +117,27 @@ runs:
EXAMPLES_PATH: ${{ github.workspace }}/examples
run: |
echo "Updating version to $NEXT_VERSION"

# Function to update the version in package.json using jq
update_version() {
local pkg_dir="$1"
local new_version="$2"
local package_json_path="$pkg_dir/package.json"

if [ -f "$package_json_path" ]; then
jq --arg new_version "$new_version" '.version = $new_version' "$package_json_path" > tmp.$$.json && mv tmp.$$.json "$package_json_path"
echo "Updated version in $package_json_path to $new_version"
else
echo "::warn::Warning: No package.json found in $pkg_dir"
fi
}

# Function to update peerDependencies in package.json
update_peer_dependencies() {
local pkg_dir="$1"
local new_version="$2"
local package_json_path="$pkg_dir/package.json"

if [ -f "$package_json_path" ]; then
for dep in "${sdk_packages[@]}"; do
if jq -e ".peerDependencies[\"@dotcms/$dep\"]" "$package_json_path" >/dev/null; then
Expand All @@ -144,13 +151,13 @@ runs:
echo "::warn::Warning: No package.json found in $pkg_dir"
fi
}

# Function to update dependencies in examples package.json
update_dependencies_in_examples() {
local example_dir="$1"
local new_version="$2"
local package_json_path="$example_dir/package.json"

if [ -f "$package_json_path" ]; then
for dep in "${sdk_packages[@]}"; do
if jq -e ".dependencies[\"@dotcms/$dep\"]" "$package_json_path" >/dev/null; then
Expand All @@ -166,20 +173,20 @@ runs:
echo "::warn::Warning: No package.json found in $example_dir"
fi
}

# Detect all SDK packages dynamically in the libs/sdk directory
sdk_packages=($(find . -maxdepth 1 -type d -exec basename {} \; | grep -v "^\.$"))

# Step 1: Update the version in each SDK package
for sdk in "${sdk_packages[@]}"; do
update_version "$sdk" "$NEXT_VERSION"
done

# Step 2: Update peerDependencies in each SDK package
for sdk in "${sdk_packages[@]}"; do
update_peer_dependencies "$sdk" "$NEXT_VERSION"
done

# Step 3: Update dependencies in example projects
example_packages=$(find $EXAMPLES_PATH -name "package.json" -not -path "*/node_modules/*")

Expand All @@ -201,19 +208,19 @@ runs:
echo "::group::Printing SDK and Example packages"
echo "SDK libs:"
print_packages "$SDK_LIBS_PATH"
echo ""
echo ""
echo "Examples:"
print_packages "$EXAMPLES_PATH"
echo "::endgroup::"
shell: bash
shell: bash

- name: 'Install project'
working-directory: ${{ github.workspace }}/core-web/
run: |
run: |
yarn install
npm --version
node --version
npx --version
npx --version
shell: bash

- name: 'Build SDK packages'
Expand All @@ -229,14 +236,14 @@ runs:
NPM_AUTH_TOKEN: ${{ inputs.npm-token }}
NPM_TAG: ${{ inputs.npm-package-tag }}
run: |
echo "::group::Publishing SDK packages"
echo "::group::Publishing SDK packages"
sdks=$(ls)
for sdk in $sdks; do
echo "Publishing SDK lib [${sdk}]"
cd $sdk && echo "$(pwd)"
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > ~/.npmrc
npm publish --access public --tag $NPM_TAG
npm dist-tag add @dotcms/${sdk}@${NEXT_VERSION} latest
npm dist-tag add @dotcms/${sdk}@${NEXT_VERSION} next
cd ..
done
echo "::endgroup::"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ jobs:
- name: Set up QEMU
uses: docker/[email protected]
with:
image: tonistiigi/binfmt:latest
image: tonistiigi/binfmt:qemu-v7.0.0
platforms: ${{ inputs.docker_platforms }}
if: success()

Expand Down
2 changes: 2 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# require review from someone with some addtional experience
* @dotCMS/core-workflow-developers
2 changes: 1 addition & 1 deletion parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
<version.rewrite-maven-plugin>5.21.0</version.rewrite-maven-plugin>
<version.shade.plugin>3.2.1</version.shade.plugin>
<version.site.plugin>4.0.0-M8</version.site.plugin>
<version.sonar.plugin>3.10.0.2594</version.sonar.plugin>
<version.sonar.plugin>3.11.0.3922</version.sonar.plugin>
<version.source.plugin>3.1.0</version.source.plugin>
<version.frontend.plugin>1.12.1</version.frontend.plugin>
<version.properties.plugin>1.2.1</version.properties.plugin>
Expand Down
14 changes: 14 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"enabled": true,
"prHourlyLimit": 0,
"prConcurrentLimit": 0,
"automerge": false,
"packageRules": [
{
"matchDepTypes": ["dependencies", "devDependencies"],
"enabled": false
}
],
"dependencyDashboard": true

}
Loading