ci: 更新 .gitlab-ci.yml 和 update_files.py
- 移除了 .gitlab-ci.yml 中的安全扫描配置 - 调整了 CI/CD 流水线的阶段 - 优化了 update_files.py 脚本的输出信息 - 添加了脚本执行开始的提示信息 - 修改了没有更新文件时的提示信息
This commit is contained in:
@@ -1,17 +1,6 @@
|
|||||||
# You can override the included template(s) by including variable overrides
|
|
||||||
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
|
|
||||||
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/pipeline/#customization
|
|
||||||
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
|
|
||||||
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
|
|
||||||
# Note that environment variables can be set in several places
|
|
||||||
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
|
|
||||||
include:
|
|
||||||
- template: Security/Secret-Detection.gitlab-ci.yml
|
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
|
||||||
- auto-update
|
- auto-update
|
||||||
- build-web
|
- build-docs
|
||||||
|
|
||||||
auto-update:
|
auto-update:
|
||||||
# 需要配置 REPO_TOKEN 和 THE_REPO
|
# 需要配置 REPO_TOKEN 和 THE_REPO
|
||||||
@@ -30,6 +19,7 @@ auto-update:
|
|||||||
- pip install pyyaml
|
- pip install pyyaml
|
||||||
# 运行更新脚本
|
# 运行更新脚本
|
||||||
- python update_files.py
|
- python update_files.py
|
||||||
|
|
||||||
# build-web:
|
# build-web:
|
||||||
# stage: build-web
|
# stage: build-web
|
||||||
# image: node:22.14.0
|
# image: node:22.14.0
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import os
|
import os
|
||||||
import yaml
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
def download_file(url):
|
def download_file(url):
|
||||||
"""使用 curl 下载文件内容"""
|
"""使用 curl 下载文件内容"""
|
||||||
result = subprocess.run(["curl", "-s", url], capture_output=True, text=True)
|
result = subprocess.run(["curl", "-s", url], capture_output=True, text=True)
|
||||||
@@ -12,15 +14,17 @@ def download_file(url):
|
|||||||
return None
|
return None
|
||||||
return result.stdout
|
return result.stdout
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# 读取 list.yaml
|
# 读取 list.yaml
|
||||||
try:
|
try:
|
||||||
with open("list.yaml", "r", encoding="utf-8") as f:
|
with open("list.yaml", "r", encoding="utf-8") as f:
|
||||||
items = yaml.safe_load(f)
|
items = yaml.safe_load(f)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print("list.yaml 文件不存在。")
|
print("❌ list.yaml 文件不存在。")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
print("🚀 开始更新文件")
|
||||||
modified = False
|
modified = False
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
@@ -72,7 +76,8 @@ def main():
|
|||||||
subprocess.run(["git", "commit", "-m", commit_message], check=False)
|
subprocess.run(["git", "commit", "-m", commit_message], check=False)
|
||||||
subprocess.run(["git", "push", "origin", "main"], check=True)
|
subprocess.run(["git", "push", "origin", "main"], check=True)
|
||||||
else:
|
else:
|
||||||
print("没有需要更新的文件。")
|
print("📦 没有需要更新的文件。")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user