deploy to gh-pages

This commit is contained in:
yushijinhun 2020-08-17 22:17:21 +08:00
parent c412db53a7
commit 78e236b18c
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4
4 changed files with 57 additions and 7 deletions

View File

@ -1,6 +1,6 @@
name: CI
on: [push]
on: [push, pull_request]
jobs:
test:
@ -9,8 +9,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: npm build & test
run: |
npm install
npm run build
npm test
- run: npm install
- run: npm run build
- run: npm test

31
.github/workflows/deploy-ghpages.yaml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Deploy to GitHub Pages
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npm run build
- run: npm test
- name: Prepare files
run: |
cp -r examples public
cp -r bundles public/js
build_commit="${{ github.sha }}"
build_time=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
sed -Ez \
-e 's#\.\./bundles/skinview3d\.bundle\.js#js/skinview3d.bundle.js#g' \
-e 's#\{\{build_commit\}\}#'$build_commit'#g' \
-e 's#\{\{build_time\}\}#'$build_time'#g' \
-e 's#<!--%%deploy_only%%(.*)-->#\1#g' \
-i public/index.html
- uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: public
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored
View File

@ -62,3 +62,4 @@ libs/
_ignore/
.DS_Store
.rpt2_cache
public/

View File

@ -7,6 +7,7 @@
<style>
body {
font-family: "Helvetica Neue", "Helvetica", "Arial", "sans-serif";
width: max-content;
}
h1 {
@ -75,6 +76,12 @@
margin: 0;
width: 100%;
}
footer {
margin-top: 10px;
padding-top: 10px;
border-top: 1px grey solid;
}
</style>
</head>
@ -82,7 +89,7 @@
<div id="skin_container"></div>
<div>
<div class="controls">
<button id="reset_all" type="button" class="control">Reset All</button>
@ -199,6 +206,19 @@
</div>
<footer>
<div>
GitHub: <a href="https://github.com/bs-community/skinview3d">bs-community/skinview3d</a>
</div>
<!--%%deploy_only%%
<div>
Built from
commit <a href="https://github.com/bs-community/skinview3d/commit/{{build_commit}}">{{build_commit}}</a>
at <time datetime="{{build_time}}">{{build_time}}</time>
</div>
-->
</footer>
<script src="../bundles/skinview3d.bundle.js"></script>
<script>
const skinParts = ["head", "body", "rightArm", "leftArm", "rightLeg", "leftLeg"];