This commit is contained in:
weyu 2025-03-30 20:37:58 +08:00
parent 27bbee75b4
commit f15a6c2b2a
5 changed files with 93 additions and 2 deletions

40
.github/workflows/cni.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: To-To-To CNI
on:
schedule:
- cron: "15 3 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: CNI To-To-To
run: |
set -x
source libs/aliyun.sh
install_aliyun_ossutil
initdir=`pwd`
source ${initdir}/libs/common.sh
cat ${initdir}/sed/* > ${initdir}/toto.sed
for project in "https://github.com/containernetworking/cni.dev.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

View File

@ -28,4 +28,5 @@ https://github.com/spiffe/spiffe.io.git
https://github.com/falcosecurity/falco-website.git
https://github.com/in-toto/in-toto.io.git
https://github.com/kyverno/website.git
https://github.com/notaryproject/notaryproject.dev.git
https://github.com/notaryproject/notaryproject.dev.git
https://github.com/containernetworking/cni.dev.git

View File

@ -22,6 +22,13 @@ install_hugo_v68_3(){
sudo cp ./hugo /usr/bin/
sudo chmod +x /usr/bin/hugo
}
install_hugo_v80(){
echo "=============================================> 安装 Hugo V0.80.0"
wget -q https://github.com/gohugoio/hugo/releases/download/v0.80.0/hugo_extended_0.80.0_Linux-64bit.tar.gz
tar xf hugo_extended_0.80.0_Linux-64bit.tar.gz
sudo cp ./hugo /usr/bin/
sudo chmod +x /usr/bin/hugo
}
install_hugo_v83_1(){
echo "=============================================> 安装 Hugo V0.83.1"
wget -q https://github.com/gohugoio/hugo/releases/download/v0.83.1/hugo_extended_0.83.1_Linux-64bit.tar.gz

View File

@ -1 +1 @@
https://github.com/notaryproject/notaryproject.dev.git
https://github.com/containernetworking/cni.dev.git

43
webs/cni/toto.sh Normal file
View File

@ -0,0 +1,43 @@
workdir=$1
initdir=$2
source ${initdir}/libs/common.sh
before_cni_website(){
install_hugo_v80
install_postcss
# 添加网站访问统计
echo '<script defer src="https://umami.cncfstack.com/script.js" data-website-id="8487f759-4fa6-4d01-9ead-477f675bfaf9"></script>' >> ./layouts/partials/favicon.html
}
after_cni_website(){
#npm run build:production
mkdir output
hugo \
--destination ./output \
--cleanDestinationDir \
--minify \
--gc \
--enableGitInfo \
--baseURL https://cni.cncfstack.com
}
save_return(){
ls -lha
echo "${workdir}/output&oss://cncfstack-cni" > ${workdir}/ret-data
}
cd $workdir
if cat .git/config |grep '/containernetworking/cni.dev.git' ;then
echo "=============================================> 匹配到 cni"
before_cni_website
after_cni_website
find_and_sed_v2 "./output"
save_return
fi