Skip to content

Deploy on GH-pages

Deploy on GH-pages #17

name: Deploy on GH-pages
on:
workflow_dispatch:
inputs:
branch:
description: 'Master branch'
required: true
default: 'master'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Configure github
run: |
git config user.email "[email protected]"
git config user.name "GitHub Action"
git remote -v
git remote set-url origin [email protected]:${GITHUB_REPOSITORY}.git
git remote -v
- name: Install node packages
run: npm install
- name: TEST
run: npm test
- name: BUILD
run: npm run build
- name: DEPLOY
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
run: |
SSH_DIR="${HOME}/.ssh"
mkdir "${SSH_DIR}"
ssh-keyscan -t rsa github.com > "${SSH_DIR}/known_hosts"
echo "${ACTIONS_DEPLOY_KEY}" > "${SSH_DIR}/id_rsa"
chmod 400 "${SSH_DIR}/id_rsa"
git add -f build/.
git commit -am "Built latest version as a GH action"
git subtree split --prefix build -b gh-pages
git push -f origin gh-pages:gh-pages