name: Deploy build to GitHub Pages
on:
push:
branches:
- main
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '18'
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Set up SSH Agent
uses: webfactory/ssh-agent@v0.5.1
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: Deploy
run: |
# Set up git with your name and email
git config --global user.name 'Andrii Bondariev'
git config --global user.email 'andreybond13@gmail.com'
git clone git@github.com:andreasblaze/andreasblaze.github.io.git
cd andreasblaze.github.io
git checkout main
find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name '..' -exec rm -rf {} \;
cp -a ../build/* ./
git add .
git commit -m "Deploy to GitHub Pages"
git push origin main