Skip to content

Commit

Permalink
双站点部署
Browse files Browse the repository at this point in the history
  • Loading branch information
Potat0000 committed Feb 22, 2024
1 parent 2207d20 commit 7200081
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
31 changes: 26 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ jobs:
permissions:
contents: read
deployments: write
strategy:
fail-fast: false
matrix:
platform:
- main
- cn
steps:
- name: Set up Node.js
uses: actions/setup-node@main
Expand All @@ -33,16 +39,31 @@ jobs:
npm install
- name: Get and Patch Lib Files
run: |
echo "MOEICP=20221816" >> $GITHUB_ENV
echo "OSS_BUCTET=potat0-box" >> $GITHUB_ENV
echo "REFRESH_URL=xn--udsw05j.space" >> $GITHUB_ENV
mv source/favicon/* source/
rm -rf source/favicon
curl https://cdn.jsdelivr.net/gh/PrismJS/prism-themes@master/themes/prism-material-light.min.css --create-dirs -o node_modules/prismjs/themes/prism-materiallight.css
curl https://cdn.jsdelivr.net/gh/PrismJS/prism-themes@master/themes/prism-material-oceanic.min.css --create-dirs -o node_modules/prismjs/themes/prism-materialoceanic.css
sed -i 's,http://,https://,g' node_modules/hexo-theme-fluid/layout/_partials/footer/beian.ejs
- name: Patch for CN-Domain website
if: ${{ matrix.platform == 'cn' }}
run: |
echo "MOEICP=20241816" >> $GITHUB_ENV
echo "OSS_BUCTET=potat0-box-cn" >> $GITHUB_ENV
echo "REFRESH_URL=potat0.cc" >> $GITHUB_ENV
sed -i 's/potat0.cc/土豆.space/g' _config.yml
sed -i 's/potat0.cc/土豆.space/g' source/manifest.json
sed -i 's/potat0.cc/土豆.space/g' source/robots.txt
sed -i 's/icp_text: 浙ICP备2021017952号-1/icp_text: 浙ICP备2021017952号-2/g' _config.fluid.yml
sed -i 's/police_text: 浙公网安备33010602011812号/police_text:/g' _config.fluid.yml
sed -i 's/police_code: 33010602011812/police_code:/g' _config.fluid.yml
- name: Build
run: |
hexo g
sed -i 's`IEJUMPIEJUMPIEJUMP`if(/*@cc_on!@*/false||(!!window.MSInputMethodContext\&\&!!document.documentMode))window.location.href="https://support.dmeng.net/upgrade-your-browser.html?referrer="+encodeURIComponent(window.location.href);`g' `grep IEJUMPIEJUMPIEJUMP -rl ./public`
sed -i 's`<div class="beian"><span>`<div class="beian"><span><a href="https://icp.gov.moe/?keyword=20221816"target="_blank"rel="nofollow">萌ICP备20221816号</a></span><span style="margin-bottom:.25rem">`g' `grep '<div class="beian">' -rl ./public`
sed -i 's,IEJUMPIEJUMPIEJUMP,if(/*@cc_on!@*/false||(!!window.MSInputMethodContext\&\&!!document.documentMode))window.location.href="https://support.dmeng.net/upgrade-your-browser.html?referrer="+encodeURIComponent(window.location.href);,g' $(grep IEJUMPIEJUMPIEJUMP -rl ./public)
sed -i "s,<div class=\"beian\"><span>,<div class=\"beian\"><span><a href=\"https://icp.gov.moe/?keyword=$MOEICP\"target=\"_blank\"rel=\"nofollow\">萌ICP备$MOEICP号</a></span><span style=\"margin-bottom:.25rem\">,g" $(grep '<div class=\"beian\">' -rl ./public)
- name: Clean up
run: |
cd public
Expand All @@ -53,15 +74,15 @@ jobs:
with:
accessKeyId: ${{ secrets.ALIYUN_ACCESSKEY_ID }}
accessKeySecret: ${{ secrets.ALIYUN_ACCESSKEY_SECRET }}
bucket: potat0-box
bucket: ${{ env.OSS_BUCTET }}
endpoint: oss-cn-hangzhou.aliyuncs.com
folder: public
incremental: true
skipSetting: true
- name: Aliyun CDN Refresh
- name: Refresh Aliyun CDN
uses: visionwx/ali-cdn-refresh@v0.1.1
with:
accessKeyId: ${{ secrets.ALIYUN_ACCESSKEY_ID }}
accessKeySecret: ${{ secrets.ALIYUN_ACCESSKEY_SECRET }}
type: Directory
path: https://potat0.cc/
path: https://${{ env.REFRESH_URL }}/
2 changes: 1 addition & 1 deletion _config.fluid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ footer:
# ICP证号
icp_text: 浙ICP备2021017952号-1
# 公安备案号,不填则只显示ICP
police_text: "浙公网安备 33010602011812号"
police_text: 浙公网安备33010602011812号
# 公安备案的编号,用于URL跳转查询
police_code: 33010602011812
# 公安备案的图片. 为空时不显示备案图片
Expand Down

0 comments on commit 7200081

Please sign in to comment.