test deploy
Some checks failed
Deploy to Private Server / vite-build (push) Failing after 3m28s
Deploy to Private Server / deploy (push) Has been skipped

This commit is contained in:
2025-12-24 14:20:56 +07:00
parent f1f5bd5169
commit 700aecc14f

View File

@@ -5,52 +5,41 @@ on:
branches: [ "main" ]
jobs:
deploy:
runs-on: homesrv
vite-build:
runs-on: node-20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Verify build output
- uses: actions/checkout@v4
- name: Build Vite app
working-directory: ./src
run: |
if [ ! -d "dist" ]; then
echo "Error: dist directory not found"
exit 1
fi
npm ci
npm run build
- name: Deploy to server
- name: Upload Vite artifacts
uses: actions/upload-artifact@v4
with:
name: vite-dist
path: dist
deploy:
runs-on: ubuntu-latest
needs: vite-build
steps:
- uses: actions/checkout@v4
- name: Download Vite artifacts
uses: actions/download-artifact@v4
with:
name: vite-dist
path: dist
- name: Deploy to Private Server
run: |
DEPLOY_PATH="/var/www/app/vite-app/timelapse-calc"
BACKUP_PATH="/var/www/app/vite-app/timelapse-calc.backup"
rm -rf /deploy/vite-app/timelapse-calc
cp -r dist/* /deploy/vite-app/timelapse-calc/
rm -rf dist
# Create backup if directory exists
if [ -d "$DEPLOY_PATH" ]; then
echo "Creating backup..."
rm -rf "$BACKUP_PATH"
mv "$DEPLOY_PATH" "$BACKUP_PATH"
fi
# Create deployment directory
mkdir -p "$DEPLOY_PATH"
# Copy new build
echo "Deploying new build..."
cp -r dist/* "$DEPLOY_PATH/"
# Verify deployment
if [ $? -eq 0 ]; then
echo "Deployment successful!"
rm -rf "$BACKUP_PATH"
else
echo "Deployment failed! Restoring backup..."
rm -rf "$DEPLOY_PATH"
mv "$BACKUP_PATH" "$DEPLOY_PATH"
exit 1
fi
echo "Deployment completed successfully"