Skip to content

Update main.yml

Update main.yml #2

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- v4
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22.6.0
- name: Install Dependencies
run: npm install
- name: Build Project
run: npx quartz build
- name: Check Build Status
id: check_build
run: |
if [ -f public ]; then
echo "Build succeeded"
else
echo "Build failed"
exit 1
fi
- name: Rsync Files to Remote Server
if: success()
uses: contention/[email protected]
with:
FLAGS: -avz --delete
EXCLUDES: --exclude '.git*' --exclude 'node_modules' #could break things
USER: ${{ secrets.USER }}
HOST: ${{ secrets.REMOTE_HOST }}
LOCALPATH: ./ # Adjust the source directory if needed
REMOTEPATH: ${{ secrets.REMOTE_PATH }}
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
# Add the following if you want to use SSH for secure connections
# Add your SSH key in the repository secrets with the name `SSH_PRIVATE_KEY`
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}