knative fix

This commit is contained in:
weyu 2025-04-25 17:29:34 +08:00
parent c38f47dd44
commit cab2c19de9
3 changed files with 41 additions and 2 deletions

View File

@ -10,6 +10,6 @@ jobs:
- uses: actions/checkout@v4
- name: Push To-To-To
run: |
/bin/bash build.sh https://github.com/jaegertracing/documentation.git
/bin/bash build.sh /knative/docs.git
src=`cat project_dir/ret-data|grep -v ^$|head -n 1`
./ossutil --access-key-id ${{ secrets.ALIYUN_CYG_OSS_AK }} --access-key-secret ${{ secrets.ALIYUN_CYG_OSS_SK }} --endpoint ${{ secrets.ALIYUN_CYG_OSS_ENDPOINT }} --region ${{ secrets.ALIYUN_CYG_OSS_REGION }} cp -f ${src} oss://cncfstack-website/

View File

@ -284,4 +284,43 @@ cycle_sed(){
log_info "$file 文件被替换"
cat $file
done
}
filetoto(){
path=$1
find $path -type f > /tmp/sed-file-list
log_info "/tmp/sed-file-list 文件内容"
cat /tmp/sed-file-list
curl -fsSL https://raw.githubusercontent.com/cncfstack/filetoto/refs/heads/main/static.file -o /tmp/static.file
curl -fsSL https://raw.githubusercontent.com/cncfstack/filetoto/refs/heads/main/special.file-and-sed -o /tmp/special.file-and-sed
cat /tmp/static.file|awk -F'https://' '{print "s|"$0"|https://filetoto.cncfstack.com/"$2"|g"}' > /tmp/toto.sed
cat /tmp/special.file-and-sed >> /tmp/toto.sed
log_info "/tmp/toto.sed 文件内容"
cat /tmp/toto.sed
# 循环依次处理可能包含外部链接的文件,并进行替换
for file in `cat /tmp/sed-file-list`
do
file -b $file |grep "text"
if [ $? -ne 0 ];then
log_info "NOT ASCII text, Just Skip: $file"
continue
fi
sudo sed -i -f /tmp/toto.sed $file
# 部分CSS引用时会添加完整性校验修改了文件后不删除校验会导致浏览器拒绝处理
sed -i 's/integrity="[^"]*"//g' $file
log_info "$file 文件被替换"
done
}

View File

@ -51,6 +51,6 @@ if cat .git/config |grep '/knative/docs.git' ;then
log_info "匹配到 knative"
before_build
build
find_and_sed_v2 "./build"
filetoto "./build"
save_return
fi