diff --git a/.github/workflows/sync_contentful.yml b/.github/workflows/sync_contentful.yml index f0bd28640..1006a9f9b 100644 --- a/.github/workflows/sync_contentful.yml +++ b/.github/workflows/sync_contentful.yml @@ -35,7 +35,10 @@ jobs: done if [ -n "$appnames" ]; then appnames=${appnames:0:-1} - echo $appnames + echo update $appnames + else + echo "update all" + appnames=$(find ./apps -mindepth 1 -maxdepth 1 -type d -exec basename {} \;) fi echo "APP_LISTS=$appnames" >> $GITHUB_OUTPUT diff --git a/apps/wordpress/variables.json b/apps/wordpress/variables.json index be9eadf80..9565eb646 100644 --- a/apps/wordpress/variables.json +++ b/apps/wordpress/variables.json @@ -7,7 +7,7 @@ { "dist": "community", "version": [ - "6.3", + "6.4", "latest" ] } diff --git a/apps/zentao/variables.json b/apps/zentao/variables.json index a16c4c810..958a5ec52 100644 --- a/apps/zentao/variables.json +++ b/apps/zentao/variables.json @@ -7,7 +7,7 @@ { "dist": "community", "version": [ - "18.8", + "18.6", "latest" ] } diff --git a/build/sync_contentful.py b/build/sync_contentful.py index ac256fe04..fa4949e87 100644 --- a/build/sync_contentful.py +++ b/build/sync_contentful.py @@ -50,67 +50,39 @@ def update_contentful(product_name, editions, requirements): # 遍历 apps 文件夹下app_lists下的 variables.json 文件 apps_path = Path('apps') app_lists_str = os.getenv('APP_LISTS', '') -if not app_lists_str: # 如果 app_lists_str 为空 - app_lists = app_lists_str.split(',') - for product_name in app_lists: - variables_file = apps_path / product_name / 'variables.json' - try: - with open(variables_file) as file: - data = json.load(file) - editions = data['edition'] - requirements = data['requirements'] - - total_updates += 1 - if update_contentful(product_name, editions, requirements): - successful_updates += 1 - else: - failed_updates += 1 - failed_products.append(product_name) - except FileNotFoundError: - print(f"File not found: {variables_file}") - failed_updates += 1 - failed_products.append(product_name) - except json.JSONDecodeError as e: - print(f"JSON decode error in file {variables_file}: {e}") - failed_updates += 1 - failed_products.append(product_name) - except Exception as e: - print(f"An unexpected error occurred while processing file {variables_file}: {e}") - failed_updates += 1 - failed_products.append(product_name) +app_lists = app_lists_str.split(',') + +for product_name in app_lists: + variables_file = apps_path / product_name / 'variables.json' + try: + with open(variables_file) as file: + data = json.load(file) + editions = data['edition'] + requirements = data['requirements'] + + total_updates += 1 + if update_contentful(product_name, editions, requirements): + successful_updates += 1 + else: + failed_updates += 1 + failed_products.append(product_name) + except FileNotFoundError: + print(f"File not found: {variables_file}") + failed_updates += 1 + failed_products.append(product_name) + except json.JSONDecodeError as e: + print(f"JSON decode error in file {variables_file}: {e}") + failed_updates += 1 + failed_products.append(product_name) + except Exception as e: + print(f"An unexpected error occurred while processing file {variables_file}: {e}") + failed_updates += 1 + failed_products.append(product_name) -else: - # 遍历 apps 文件夹中的 variables.json 文件 - for variables_file in apps_path.rglob('variables.json'): - try: - with open(variables_file) as file: - data = json.load(file) - product_name = data['name'] - editions = data['edition'] - requirements = data['requirements'] - - total_updates += 1 - if update_contentful(product_name, editions, requirements): - successful_updates += 1 - else: - failed_updates += 1 - failed_products.append(product_name) - except json.JSONDecodeError as e: - # 使用父目录的名称来标识出现问题的 JSON 文件 - parent_dir_name = variables_file.parent.name - print(f"JSON decode error in file {variables_file}: {e}") - failed_updates += 1 - failed_products.append(parent_dir_name) # 使用父目录名作为产品名 - except Exception as e: - # 同样,使用父目录的名称来标识出现问题的 JSON 文件 - parent_dir_name = variables_file.parent.name - print(f"An unexpected error occurred while processing file {variables_file}: {e}") - failed_updates += 1 - failed_products.append(parent_dir_name) # 使用父目录名作为产品名 # 打印更新报告 print(f"Total updates attempted: {total_updates}") print(f"Successful updates: {successful_updates}") print(f"Failed updates: {failed_updates}") if failed_updates > 0: - print(f"Failed products: {failed_products}") + print(f"Failed products: {failed_products}") \ No newline at end of file