Skip to content

【优化】浏览器缓存 #108

【优化】浏览器缓存

【优化】浏览器缓存 #108

Workflow file for this run

name: HomeBuildCI
on:
workflow_dispatch:
push:
branches:
- '**'
- '!gh-pages'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pull-requests: write # To create a PR from that branch
steps:
# Check
- uses: actions/checkout@v4
with:
ref: home
submodules: recursive
- run: |
echo '创建 temp/:'
mkdir /home/runner/temp
echo '复制 ./* 到 /home/runner/temp/*:'
cp -v -u -r ./* /home/runner/temp/
echo '检查 temp/:'
ls /home/runner/temp/
# HTML/CSS/JS Minifier
- run: |
cd /home/runner/temp/
- uses: docker://devatherock/minify-js:2.0.0
with:
add_suffix: false
# Run merge home and gh-pages
- uses: actions/checkout@v4
with:
ref: gh-pages
- run: |
echo '如果存在则删除 ./css:'
if [ -d "./css/" ];then
rm -r ./css/
else
echo "文件夹不存在。"
fi;
echo '复制 /home/runner/temp/css/ 到 ./css/:'
cp -v -u -r /home/runner/temp/css/ ./css/
- run: |
echo '如果存在则删除 ./js'
if [ -d "./js/" ];then
rm -r ./js/
else
echo "文件夹不存在。"
fi;
echo '复制 /home/runner/temp/js/ 到 ./js/:'
cp -v -u -r /home/runner/temp/js/ ./js/
- run: |
echo '如果存在则删除 ./footer.html:'
if [ ! -f "./footer.html" ];then
echo "文件不存在"
else
rm -d ./footer.html
fi
echo '复制 /home/runner/temp/footer.html 到 ./footer.html:'
cp -v -u -r /home/runner/temp/footer.html ./footer.html
- run: |
echo '如果存在则删除 ./Character_substitution:'
if [ -d "./Character_substitution/" ];then
rm -r ./Character_substitution/
else
echo "文件夹不存在。"
fi;
echo '复制 /home/runner/temp/Character_substitution/ 到 ./Character_substitution/:'
cp -v -u -r /home/runner/temp/Character_substitution/ ./Character_substitution/
- run: |
echo '如果存在则删除 ./index.html:'
if [ ! -f "./index.html" ];then
echo "文件不存在"
else
rm -d ./index.html
fi
echo '复制 /home/runner/temp/index.html 到 ./index.html:'
cp -v -u -r /home/runner/temp/index.html ./index.html
- run: |
echo '如果存在则删除 ./404.html:'
if [ ! -f "./404.html" ];then
echo "文件不存在"
else
rm -d ./404.html
fi
echo '复制 /home/runner/temp/404.html 到 ./404.html:'
cp -v -u -r /home/runner/temp/404.html ./404.html
- run: |
echo '如果存在则删除 ./Community.html:'
if [ ! -f "./Community.html" ];then
echo "文件不存在"
else
rm -d ./Community.html
fi
echo '复制 /home/runner/temp/Community.html 到 ./Community.html:'
cp -v -u -r /home/runner/temp/Community.html ./Community.html
- name: Generate the sitemap
id: sitemap
uses: cicirello/generate-sitemap@v1
with:
base-url-path: https://hamud.pj568.sbs/
- name: Output sitemap stats
run: |
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
# Deploy
- uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: . # The folder the action should deploy.
- name: Ping Google
run: curl https://www.google.com/ping?sitemap=https://hamud.pj568.sbs/sitemap.xml