Skip to content

Commit

Permalink
rm cdn; use local statics file
Browse files Browse the repository at this point in the history
  • Loading branch information
axiaoxin committed Nov 20, 2021
1 parent 0c520da commit 0a8a5e0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: CGO_ENABLED=0 go build -o app -tags=jsoniter

- name: Tar
run: tar czvf app.tar.gz app
run: tar czvf app.tar.gz app statics

- name: SCP Files
uses: appleboy/scp-action@master
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ archives:
amd64: x86_64
files:
- config.toml
- statics/js/app.min.*.js
- statics/**/*
checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
16 changes: 1 addition & 15 deletions misc/scripts/app.min.js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,4 @@ echo "压缩js..."
uglifyjs --compress --mangle --output ${SRC_PATH}/${NEW_NAME} -- ${SRC_PATH}/app.js && \

echo "替换html..."
sed -i '' -e "s|investool/js/app.*.js\"{{ else }}|investool/js/${NEW_NAME}\"{{ else }}|g" ${PROJECT_PATH}/statics/html/base.html && \

echo "上传cdn..."
qshell fput blogpostpics investool/js/${NEW_NAME} ${SRC_PATH}/${NEW_NAME} && \

echo "保存预取刷新文件名..."
echo "http://cdn.axiaoxin.com/investool/js/${NEW_NAME}" > /tmp/qiniu-prefetch-refresh-list.txt && \
echo "cdn预取..."
qshell cdnprefetch -i /tmp/qiniu-prefetch-refresh-list.txt && \
echo "cdn刷新..."
qshell cdnrefresh -i /tmp/qiniu-prefetch-refresh-list.txt

echo "设置清理文件..."
mv /tmp/qiniu-latest-list.txt /tmp/qiniu-del-list.txt
echo "investool/js/${NEW_NAME}" > /tmp/qiniu-latest-list.txt
sed -i '' -e "s|investool/js/app.*.js\"{{ else }}|investool/js/${NEW_NAME}\"{{ else }}|g" ${PROJECT_PATH}/statics/html/base.html
2 changes: 0 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ echo "push..."
git push && git push --tags -f && \
echo "release..."
goreleaser release --rm-dist
echo "cdn清理..."
qshell batchdelete blogpostpics -y -i /tmp/qiniu-del-list.txt
22 changes: 11 additions & 11 deletions statics/html/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, minimum-scale=1.0, maximum-scale=1, shrink-to-fit=no" />

<link rel="shortcut icon" href="http://cdn.axiaoxin.com/investool/favicon.ico">
<link rel="shortcut icon" href="/statics/favicon.ico">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="http://cdn.axiaoxin.com/css/materialize.min.css" media="screen,projection" />
<link rel="stylesheet" href={{ if eq .Env "prod" }}"http://cdn.axiaoxin.com/investool/css/app.css"{{ else }}"/statics/css/app.css"{{ end }} />
<link type="text/css" rel="stylesheet" href="/statics/css/materialize.min.css" media="screen,projection" />
<link rel="stylesheet" href="/statics/css/app.css" />
<title>{{ .PageTitle }}</title>
<!-- 百度统计 -->
<script>
Expand Down Expand Up @@ -48,9 +48,9 @@
<li>
<div class="user-view">
<div class="background">
<img src={{ if eq .Env "prod" }}"http://cdn.axiaoxin.com/investool/img/sidenav_bg.png"{{ else }}"/statics/img/sidenav_bg.png"{{ end }}>
<img src="/statics/img/sidenav_bg.png">
</div>
<a href="#!"><img class="circle" src={{ if eq .Env "prod" }}"http://cdn.axiaoxin.com/investool/img/sidenav_icon.png"{{ else }}"/statics/img/sidenav_icon.png"{{ end }}></a>
<a href="#!"><img class="circle" src="/statics/img/sidenav_icon.png"></a>
<a href="#!"><span class="white-text">InvesTool v{{ .Version }}</span></a>
</div>
</li>
Expand Down Expand Up @@ -134,13 +134,13 @@ <h5 class="white-text">网站</h5>
<p class="right">© 2021-<script type="text/javascript">document.write(new Date().getFullYear());</script> InvesTool, All rights reserved.</p>
</div>
</footer>
<script type="text/javascript" src="http://cdn.axiaoxin.com/js/jquery-3.6.0.min.js" ></script>
<script type="text/javascript" src="http://cdn.axiaoxin.com/js/materialize.min.js" ></script>
<script type="text/javascript" src="http://cdn.axiaoxin.com/js/tableExport.js" ></script>
<script type="text/javascript" src="http://cdn.axiaoxin.com/js/clipboard.min.js" ></script>
<script type="text/javascript" src="http://cdn.axiaoxin.com/js/chart.xkcd.min.js" ></script>
<script type="text/javascript" src="/statics/js/jquery-3.6.0.min.js" ></script>
<script type="text/javascript" src="/statics/js/materialize.min.js" ></script>
<script type="text/javascript" src="/statics/js/tableExport.js" ></script>
<script type="text/javascript" src="/statics/js/clipboard.min.js" ></script>
<script type="text/javascript" src="/statics/js/chart.xkcd.min.js" ></script>

<script type="text/javascript" src={{ if eq .Env "prod" }}"http://cdn.axiaoxin.com/investool/js/app.min.20211112-231949.js"{{ else }}"/statics/js/app.js"{{ end }} ></script>
<script type="text/javascript" src="/statics/js/app.js" ></script>

<!-- google auto ads -->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3022214826355647"
Expand Down

0 comments on commit 0a8a5e0

Please sign in to comment.