diff --git a/.github/workflows/renovate-app-version.sh b/.github/workflows/renovate-app-version.sh index 67d86905..60b5cf85 100755 --- a/.github/workflows/renovate-app-version.sh +++ b/.github/workflows/renovate-app-version.sh @@ -26,31 +26,33 @@ do current_config_version=$(jq -r '.version' "$config_file") echo "Current config version: $current_config_version" - # Update the version in config.json - contents="$(jq --arg trimmed_version "$trimmed_version" '.version=$trimmed_version' "$config_file")" - echo "${contents}" > "$config_file" + if [[ "$current_config_version" != "$trimmed_version" ]]; then + # Update the version in config.json + contents="$(jq --arg trimmed_version "$trimmed_version" '.version=$trimmed_version' "$config_file")" + echo "${contents}" > "$config_file" - # ------------------- Update docker-compose.json ------------------- - # Update the version in docker-compose.json if it exists - if [[ -f ${docker_compose_file/docker-compose.yml/docker-compose.json} ]]; then - compose_file=${docker_compose_file/docker-compose.yml/docker-compose.json} + # ------------------- Update docker-compose.json ------------------- + # Update the version in docker-compose.json if it exists + if [[ -f ${docker_compose_file/docker-compose.yml/docker-compose.json} ]]; then + compose_file=${docker_compose_file/docker-compose.yml/docker-compose.json} - echo "Updating $compose_file with version $image" + echo "Updating $compose_file with version $image" - main_service_index=$(yq '.services | to_entries[] | select(.value.isMain == true) | .key' "$compose_file") + main_service_index=$(yq '.services | to_entries[] | select(.value.isMain == true) | .key' "$compose_file") - # apply trimmed version to docker-compose.json's main service - contents="$(jq --arg image "$image" --arg main_service_index "$main_service_index" '.services[$main_service_index | tonumber].image=$image' "$compose_file")" - echo "${contents}" > "$compose_file" - npx prettier "$compose_file" --write + # apply trimmed version to docker-compose.json's main service + contents="$(jq --arg image "$image" --arg main_service_index "$main_service_index" '.services[$main_service_index | tonumber].image=$image' "$compose_file")" + echo "${contents}" > "$compose_file" + npx prettier "$compose_file" --write + fi + + # ------------------- Update config.json ------------------- + tipi_version=$(jq -r '.tipi_version' "$config_file") + tipi_version=$((tipi_version + 1)) + contents="$(jq --argjson tipi_version $tipi_version '.tipi_version=$tipi_version' "$config_file")" + echo "${contents}" > "$config_file" + npx prettier "$config_file" --write fi - - # ------------------- Update config.json ------------------- - tipi_version=$(jq -r '.tipi_version' "$config_file") - tipi_version=$((tipi_version + 1)) - contents="$(jq --argjson tipi_version $tipi_version '.tipi_version=$tipi_version' "$config_file")" - echo "${contents}" > "$config_file" - npx prettier "$config_file" --write fi done