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:
|
||||
- test
|
||||
- auto-update
|
||||
- build-web
|
||||
- build-docs
|
||||
|
||||
auto-update:
|
||||
# 需要配置 REPO_TOKEN 和 THE_REPO
|
||||
@@ -30,6 +19,7 @@ auto-update:
|
||||
- pip install pyyaml
|
||||
# 运行更新脚本
|
||||
- python update_files.py
|
||||
|
||||
# build-web:
|
||||
# stage: build-web
|
||||
# image: node:22.14.0
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import yaml
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
def download_file(url):
|
||||
"""使用 curl 下载文件内容"""
|
||||
result = subprocess.run(["curl", "-s", url], capture_output=True, text=True)
|
||||
@@ -12,15 +14,17 @@ def download_file(url):
|
||||
return None
|
||||
return result.stdout
|
||||
|
||||
|
||||
def main():
|
||||
# 读取 list.yaml
|
||||
try:
|
||||
with open("list.yaml", "r", encoding="utf-8") as f:
|
||||
items = yaml.safe_load(f)
|
||||
except FileNotFoundError:
|
||||
print("list.yaml 文件不存在。")
|
||||
print("❌ list.yaml 文件不存在。")
|
||||
sys.exit(0)
|
||||
|
||||
print("🚀 开始更新文件")
|
||||
modified = False
|
||||
|
||||
for item in items:
|
||||
@@ -72,7 +76,8 @@ def main():
|
||||
subprocess.run(["git", "commit", "-m", commit_message], check=False)
|
||||
subprocess.run(["git", "push", "origin", "main"], check=True)
|
||||
else:
|
||||
print("没有需要更新的文件。")
|
||||
print("📦 没有需要更新的文件。")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user