Update deployment script
All checks were successful
Build and Deploy / build (push) Successful in 41s
All checks were successful
Build and Deploy / build (push) Successful in 41s
This commit is contained in:
parent
464dfdf024
commit
dd53f2888e
@ -23,39 +23,15 @@ jobs:
|
|||||||
|
|
||||||
- name: Setup pnpm
|
- name: Setup pnpm
|
||||||
uses: pnpm/action-setup@v2
|
uses: pnpm/action-setup@v2
|
||||||
|
|
||||||
- name: Free up disk space
|
|
||||||
run: |
|
|
||||||
# Display disk space before cleanup
|
|
||||||
df -h
|
|
||||||
|
|
||||||
# Remove large packages without using regex
|
|
||||||
sudo apt-get remove -y azure-cli google-cloud-sdk google-chrome-stable firefox mono-runtime
|
|
||||||
sudo apt-get autoremove -y
|
|
||||||
|
|
||||||
# Remove large directories
|
|
||||||
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
|
|
||||||
|
|
||||||
# Clean Docker (if installed)
|
|
||||||
if command -v docker &> /dev/null; then
|
|
||||||
docker system prune -af
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Display disk space after cleanup
|
|
||||||
df -h
|
|
||||||
|
|
||||||
- name: Install system dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
run: |
|
||||||
# Free up disk space
|
sudo apt-get update
|
||||||
sudo rm -rf /var/lib/apt/lists/*
|
sudo apt-get install -y rsync build-essential libvips-dev
|
||||||
sudo apt-get clean
|
pnpm install
|
||||||
# Use compression to reduce download size
|
|
||||||
sudo apt-get update -o Acquire::CompressionTypes::Order::=gz
|
- name: Build Site
|
||||||
# Install minimal dependencies
|
run: pnpm run build
|
||||||
sudo apt-get install -y --no-install-recommends rsync build-essential libvips-dev
|
|
||||||
# Clean up to save space
|
|
||||||
sudo apt-get clean
|
|
||||||
sudo rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
- name: Setup SSH key
|
- name: Setup SSH key
|
||||||
run: |
|
run: |
|
||||||
@ -68,23 +44,5 @@ jobs:
|
|||||||
- name: Add server to known_hosts
|
- name: Add server to known_hosts
|
||||||
run: ssh-keyscan ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
|
run: ssh-keyscan ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Build Astro site
|
|
||||||
run: |
|
|
||||||
echo "Attempting to build with Sharp..."
|
|
||||||
if pnpm run build; then
|
|
||||||
echo "Build with Sharp successful!"
|
|
||||||
else
|
|
||||||
echo "Build with Sharp failed, falling back to passthrough image service..."
|
|
||||||
# Copy the CI config to use the passthrough image service
|
|
||||||
cp astro.config.ci.mjs astro.config.mjs
|
|
||||||
# Clean the previous failed build
|
|
||||||
rm -rf dist
|
|
||||||
# Try building again with the passthrough config
|
|
||||||
pnpm run build
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Deploy to server
|
- name: Deploy to server
|
||||||
run: rsync -avzP ./dist/ root@${{ secrets.SERVER_IP }}:/var/www/html/
|
run: rsync -avzP ./dist/ root@${{ secrets.SERVER_IP }}:/var/www/html/
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
import { defineConfig } from "astro/config";
|
|
||||||
import tailwindcss from "@tailwindcss/vite";
|
|
||||||
|
|
||||||
// https://astro.build/config
|
|
||||||
export default defineConfig({
|
|
||||||
site: 'https://justin.deal',
|
|
||||||
|
|
||||||
// Performance optimizations
|
|
||||||
compressHTML: true,
|
|
||||||
|
|
||||||
// Build optimizations
|
|
||||||
build: {
|
|
||||||
inlineStylesheets: 'auto', // Inline small stylesheets for better performance
|
|
||||||
},
|
|
||||||
|
|
||||||
// Image optimizations - using passthrough service for CI/CD
|
|
||||||
image: {
|
|
||||||
service: {
|
|
||||||
entrypoint: 'astro/assets/services/noop',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// Vite configuration
|
|
||||||
vite: {
|
|
||||||
plugins: [tailwindcss()],
|
|
||||||
|
|
||||||
// Build optimizations
|
|
||||||
build: {
|
|
||||||
// Enable chunk splitting
|
|
||||||
cssCodeSplit: true,
|
|
||||||
|
|
||||||
// Optimize chunks
|
|
||||||
rollupOptions: {
|
|
||||||
output: {
|
|
||||||
// Customize chunk naming
|
|
||||||
manualChunks: {
|
|
||||||
// Group Alpine.js and related code
|
|
||||||
alpine: ['alpinejs'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// Optimize dependencies
|
|
||||||
optimizeDeps: {
|
|
||||||
include: ['alpinejs'],
|
|
||||||
},
|
|
||||||
|
|
||||||
// CSS optimization
|
|
||||||
css: {
|
|
||||||
devSourcemap: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Enable server-side rendering optimizations
|
|
||||||
ssr: {
|
|
||||||
noExternal: ['@astrojs/tailwind'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user