Skip to content

.github/workflows/main.yml #560

.github/workflows/main.yml

.github/workflows/main.yml #560

Workflow file for this run

on:
workflow_dispatch:
repository_dispatch:
types:
- update
schedule:
- cron: '0 2 * * *'
jobs:
build_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js 20.x
uses: actions/setup-node@v2
with:
node-version: 20.x
- name: Cache node_modules
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Run install
run: yarn install
- name: Cache Yarn cache
uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-cache-
- name: Build production bundle
env:
FLUX_TOKEN: ${{ secrets.FLUX_TOKEN }}
run: yarn prod
- name: Install rsync
run: sudo apt-get install -y rsync
- name: Deploy to VPS
env:
VPS_HOST: ${{ secrets.VPS_HOST }}
VPS_PORT: ${{ secrets.VPS_PORT }}
VPS_USER: ${{ secrets.VPS_USER }}
VPS_SSH_PRIVATE_KEY: ${{ secrets.VPS_SSH_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "$VPS_SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "StrictHostKeyChecking no" >> ~/.ssh/config
rsync -avz --delete -e "ssh -p $VPS_PORT" dist/ $VPS_USER@$VPS_HOST:/var/11ty-data