Update main.yml #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 [ -d public ]; then | |
echo "Build succeeded" | |
pwd | |
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*' | |
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 }} |