diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b7c7d4b..719a2d3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/.github/workflows/deploy-ghpages.yaml b/.github/workflows/deploy-ghpages.yaml new file mode 100644 index 0000000..4f49990 --- /dev/null +++ b/.github/workflows/deploy-ghpages.yaml @@ -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##\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 }} diff --git a/.gitignore b/.gitignore index ffea957..683c975 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ libs/ _ignore/ .DS_Store .rpt2_cache +public/ diff --git a/examples/index.html b/examples/index.html index ccfcc73..7cb067a 100644 --- a/examples/index.html +++ b/examples/index.html @@ -7,6 +7,7 @@ @@ -82,7 +89,7 @@
-
+
@@ -199,6 +206,19 @@
+ +