add spiffe

This commit is contained in:
weyu 2025-03-30 19:15:57 +08:00
parent 1f1f288890
commit 8319bf4acb
6 changed files with 98 additions and 6 deletions

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

@ -0,0 +1,40 @@
name: To-To-To Spiffe
on:
schedule:
- cron: "15 3 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Spiffe 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/spiffe/spiffe.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

View File

@ -23,4 +23,5 @@ https://github.com/crossplane/docs.git
https://github.com/kedacore/keda-docs.git
https://github.com/kubeflow/website.git
https://github.com/istio/istio.io.git
https://github.com/goharbor/website.git
https://github.com/goharbor/website.git
https://github.com/spiffe/spiffe.io.git

View File

@ -15,7 +15,13 @@ install_hugo_v66(){
sudo cp ./hugo /usr/bin/
sudo chmod +x /usr/bin/hugo
}
install_hugo_v68_3(){
echo "=============================================> 安装 Hugo V0.68.3"
wget -q https://github.com/gohugoio/hugo/releases/download/v0.68.3/hugo_extended_0.68.3_Linux-64bit.tar.gz
tar xf hugo_extended_0.68.3_Linux-64bit.tar.gz
sudo cp ./hugo /usr/bin/
sudo chmod +x /usr/bin/hugo
}
install_hugo_v74(){
echo "=============================================> 安装 Hugo V0.74.0"
wget -q https://github.com/gohugoio/hugo/releases/download/v0.74.0/hugo_extended_0.74.0_Linux-64bit.tar.gz

View File

@ -1 +1 @@
https://github.com/goharbor/website.git
https://github.com/spiffe/spiffe.io.git

View File

@ -4,15 +4,15 @@ initdir=$2
source ${initdir}/libs/common.sh
before_harbor_website(){
install_hugo_v74
install_postcss
make prepare
npm i
install_hugo_v74
#install_postcss
# 添加网站访问统计
echo '<script defer src="https://umami.cncfstack.com/script.js" data-website-id="fd31286b-b455-4b8c-8d83-549b2ab02cff"></script>' >> layouts/partials/favicon.html
echo '<script defer src="https://umami.cncfstack.com/script.js" data-website-id="d2323b72-657c-4da2-9371-67f8383fc2c8"></script>' >> layouts/partials/favicon.html
}

45
webs/spiffe/toto.sh Normal file
View File

@ -0,0 +1,45 @@
workdir=$1
initdir=$2
source ${initdir}/libs/common.sh
before_spiffe_website(){
install_hugo_v68_3
# 添加网站访问统计
echo '<script defer src="https://umami.cncfstack.com/script.js" data-website-id="86f12ca0-83a8-470a-af6c-6ba96d72998e"></script>' >> layouts/partials/meta.html
}
after_spiffe_website(){
#npm run build:production
mkdir output
hugo \
--destination ./output \
--cleanDestinationDir \
--buildDrafts \
--buildFuture \
--minify \
--gc \
--enableGitInfo \
--baseURL https://spiffe.cncfstack.com
}
save_return(){
ls -lha
echo "${workdir}/output&oss://cncfstack-spiffe" > ${workdir}/ret-data
}
cd $workdir
if cat .git/config |grep '/spiffe/spiffe.io.git' ;then
echo "=============================================> 匹配到 spiffe"
before_spiffe_website
after_spiffe_website
find_and_sed_v2 "./output"
save_return
fi