修复错评论区错误 #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: HomeBuildCI | |
on: | |
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@v3 | |
with: | |
ref: home | |
- run: | | |
echo '创建 temp/:' | |
mkdir /home/runner/temp | |
echo '复制 ./* 到 /home/runner/temp/*:' | |
cp -v -u -r ./* /home/runner/temp/ | |
echo '检查 temp/:' | |
ls /home/runner/temp/ | |
- run: cd /home/runner/temp/ | |
# HTML/CSS/JS Minifier | |
- uses: docker://devatherock/minify-js:2.0.0 | |
with: | |
add_suffix: false # Optional | |
# Run merge home and gh-pages | |
- uses: actions/checkout@v3 | |
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 '如果存在则删除 ./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://***/ | |
# - 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/[email protected] | |
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://***/sitemap.xml |