Skip to content

Minimal package bumps to build successfully #114

Minimal package bumps to build successfully

Minimal package bumps to build successfully #114

name: Build and Deploy to Github Pages
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Build
run: |
npm install
export NODE_ENV=production
npm run build
- name: Prepare for deploy
run: |
mkdir -p release
rm -f release/main-*.js
js_hash=$(cat dist/main.js | sha1sum | awk '{ print $1 }')
cp dist/main.js "release/main-${js_hash}.js"
# cp dist/main.js.map "release/main-${js_hash}.js.map"
cp index.html release/
cp demo.html release/
sed -i "s/src=\"dist\/main\.js/src=\"main-${js_hash}\.js/g" release/index.html
sed -i "s/src=\"dist\/main\.js/src=\"main-${js_hash}\.js/g" release/demo.html
# sed -i "s/main\.js\.map/main-${js_hash}\.js\.map/g" "release/main-${js_hash}.js"
ls -la release
- name: Install SSH Client
uses: webfactory/ssh-agent@v0.5.0
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
BRANCH: gh-pages
FOLDER: release
SSH: true