From 097585365b60e465ca6e930c3ca0a380db9ce664 Mon Sep 17 00:00:00 2001 From: weyu <985695055@qq.com> Date: Tue, 22 Apr 2025 17:50:49 +0800 Subject: [PATCH] istio --- .github/workflows/_push.yml | 2 +- .github/workflows/istio.yml | 31 +++-------------------------- webs/istio/toto.sh | 39 ++++++++++++++++++++++++------------- 3 files changed, 30 insertions(+), 42 deletions(-) diff --git a/.github/workflows/_push.yml b/.github/workflows/_push.yml index 9163f54..1b78cca 100644 --- a/.github/workflows/_push.yml +++ b/.github/workflows/_push.yml @@ -10,6 +10,6 @@ jobs: - uses: actions/checkout@v4 - name: Push To-To-To run: | - /bin/bash build.sh https://github.com/in-toto/in-toto.io.git + /bin/bash build.sh https://github.com/istio/istio.io.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/ \ No newline at end of file diff --git a/.github/workflows/istio.yml b/.github/workflows/istio.yml index fc0d7ac..f9edb5f 100644 --- a/.github/workflows/istio.yml +++ b/.github/workflows/istio.yml @@ -10,31 +10,6 @@ jobs: - uses: actions/checkout@v4 - name: Istio To-To-To run: | - set -x - - source libs/common.sh - install_aliyun_ossutil - - initdir=`pwd` - - - - cat ${initdir}/sed/* > ${initdir}/toto.sed - - for project in "https://github.com/istio/istio.io.git" - do - - uuid=`date "+%s%N"` - workdir="${initdir}/tmp/${uuid}" - mkdir -p $workdir - - git clone $project $workdir - ls $workdir - - find ./webs -name toto.sh -exec /bin/bash {} $workdir $initdir \; - - src=`cat ${workdir}/ret-data|grep -v ^$|head -n 1|awk -F'&' '{print $1}'` - dest=`cat ${workdir}/ret-data|grep -v ^$|head -n 1|awk -F'&' '{print $2}'` - - ./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 -fr $src $dest - done \ No newline at end of file + /bin/bash build.sh https://github.com/istio/istio.io.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/ \ No newline at end of file diff --git a/webs/istio/toto.sh b/webs/istio/toto.sh index 99604e3..491f640 100644 --- a/webs/istio/toto.sh +++ b/webs/istio/toto.sh @@ -1,9 +1,6 @@ -workdir=$1 -initdir=$2 - source libs/common.sh -before_istio_website(){ +before_build(){ install_hugo_v139_3 install_postcss @@ -14,7 +11,7 @@ before_istio_website(){ } -after_istio_website(){ +build(){ mkdir output hugo \ @@ -23,22 +20,38 @@ after_istio_website(){ --minify \ --gc \ --enableGitInfo \ - --baseURL https://istio.cncfstack.com + --baseURL https://istio.website.cncfstack.com } save_return(){ - ls -lha - pwd - echo "${workdir}/output&oss://cncfstack-istio" > ${workdir}/ret-data + # ls -lha + # pwd + # echo "${workdir}/output&oss://cncfstack-istio" > ${workdir}/ret-data + + # 这行很重要,在其他关联项目中,文件名称必须要匹配 + tarfile="in-toto.tgz" + + # 进入到site目录后进行打包,这样是为了便于部署时解压 + tar -czf ${tarfile} -C output . + + if [ ! -s ${tarfile} ];then + log_error "站点构建失败" + fi + + debug_tools + + log_info "站点构建完成" + + echo "project_dir/${tarfile}" > ret-data } -cd $workdir +cd project_dir if cat .git/config |grep '/istio/istio.io.git' ;then - echo "=============================================> 匹配到 istio" - before_istio_website - after_istio_website + echo "匹配到 istio" + before_build + build find_and_sed_v2 "./output" save_return fi