This commit is contained in:
1 parent
c768d80cab
commit
f8301524f9
1 file changed
+21
-32
@@ -1,5 +1,4 @@
|
|||||||
name: Remote Build and Deploy
|
name: Remote Build and Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -8,50 +7,40 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Deploying via SSH connection to VPS Host
|
- name: Deploying via SSH connection to VPS Host
|
||||||
uses: appleboy/[email protected]
|
uses: appleboy/[email protected]
|
||||||
with:
|
with:
|
||||||
host: "172.20.2.1"
|
host: ${{ secrets.VPS_HOST }}
|
||||||
username: "root"
|
username: "root"
|
||||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
port: 22
|
port: 22
|
||||||
|
# 'set -e' zorgt ervoor dat het script stopt bij elke fout
|
||||||
script: |
|
script: |
|
||||||
|
set -e
|
||||||
echo "--- Starting EPIC WEB CONTROL Deployment ---"
|
echo "--- Starting EPIC WEB CONTROL Deployment ---"
|
||||||
|
|
||||||
# 1. Navigate to your project directory on the VPS
|
|
||||||
cd /var/www/atom-nexst/
|
cd /var/www/atom-nexst/
|
||||||
|
|
||||||
# 2. Synchronize the application files via Git
|
# 1. Veilige update
|
||||||
git fetch origin
|
git fetch origin --prune
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
|
|
||||||
# --- CLEAN-UP STEP ---
|
# 2. Cleanup (met check)
|
||||||
echo "--- Moving or removing specific items ---"
|
if [ -d "directory-name" ]; then rm -rf directory-name; fi
|
||||||
rm -rf /var/www/atom-nexst/directory-name
|
|
||||||
|
# 3. Dependencies en Build (met volledige paden voor zekerheid)
|
||||||
# Install missing node_modules based on updated package.json
|
# Vervang /usr/local/bin/ door de locatie van jouw pnpm (check met 'which pnpm')
|
||||||
echo "--- Installing Dependencies ---"
|
export PNPM_HOME="/usr/local/bin"
|
||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
# Load environment variables from .env file for the next steps
|
# 4. Database en Types
|
||||||
export $(grep -v '^#' .env | xargs)
|
|
||||||
|
|
||||||
# 3. Run database migrations natively
|
|
||||||
echo "--- Running Database Migrations ---"
|
|
||||||
pnpm db:migrate
|
pnpm db:migrate
|
||||||
|
|
||||||
# Regenerate Prisma Client to update types
|
|
||||||
echo "--- Generating Prisma Client Types ---"
|
|
||||||
pnpm prisma generate
|
pnpm prisma generate
|
||||||
|
|
||||||
# 4. Compile the updated distribution assets
|
# 5. Build en Restart
|
||||||
echo "--- Building Application ---"
|
|
||||||
pnpm build
|
pnpm build
|
||||||
|
|
||||||
# 5. Restart the host background service
|
|
||||||
echo "--- Restarting Atom Nexst Service ---"
|
|
||||||
sudo systemctl restart atom-nexst.service
|
sudo systemctl restart atom-nexst.service
|
||||||
|
|
||||||
echo "--- Deployment Completed Successfully ---"
|
echo "--- EPIC WEB CONTROL Deployment Completed Successfully ---"
|
||||||
|
|
||||||
Reference in new issue
Block a user