OSDN Git Service

enable cdn
authorIr1d <sirius.caffrey@gmail.com>
Wed, 28 Aug 2019 16:52:35 +0000 (00:52 +0800)
committerIr1d <sirius.caffrey@gmail.com>
Wed, 28 Aug 2019 16:52:35 +0000 (00:52 +0800)
.travis.yml
scripts/netlify_build.sh

index 8ce49c3..2d248a7 100644 (file)
@@ -2,11 +2,11 @@ language: python
 cache:
   pip: true
   directories:
-  - node_modules
+    - node_modules
 python:
   - 3.6
 services:
-- docker
+  - docker
 before_install:
   - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
   - source ~/.nvm/nvm.sh
@@ -38,3 +38,8 @@ after_deploy:
   - git fetch origin gh-pages
   - git checkout -b gh-pages origin/gh-pages
   - git push coding gh-pages:coding-pages -f
+  - git checkout -b cdn-pages origin/gh-pages
+  - find ./ -type f -name "*.html" -exec sed -i -E 's/([^"]*)(assets[^"]*)/https:\/\/cdn-for-oi-wiki.billchn.com\/\2/' {} +
+  - git add .
+  - git commit --author "24OI-bot <15963390+24OI-bot@users.noreply.github.com>" -m "build cdn files"
+  - git push coding cdn-pages:cdn-pages -f
index 00a8481..b8de25d 100755 (executable)
@@ -22,5 +22,7 @@ mkdocs build -v
 
 find ./site -type f -name '*.html' -exec node --max_old_space_size=512 ./scripts/render_math.js {} \;
 
+find ./site -type f -name "*.html" -exec sed -i -E 's/([^"]*)(assets[^"]*)/https:\/\/cdn-for-oi-wiki.billchn.com\/\2/' {} +
+
 # npx gulp minify
 # try to avoid netlify timeout