This commit is contained in:
1 parent
9b1bc2fd09
commit
a758cb3bfe
1 file changed
+26
-18
@@ -1,46 +1,54 @@
|
|||||||
name: Local Build and Deploy
|
name: Local Build and Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: shell
|
runs-on: shell
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Run Deploy Scripts Locally
|
- name: Run Deploy Scripts Locally
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
echo "--- EPIC WEB CONTROL: Starting Auto-Cleanup & Deploy ---"
|
echo "--- EPIC WEB CONTROL: Starting Auto-Cleanup & Deploy ---"
|
||||||
|
|
||||||
# 1. Clean up unused build images safely
|
# 1. Clean up unused build images safely
|
||||||
docker image prune -f
|
docker image prune -f
|
||||||
|
|
||||||
# 2. Navigate to your website directory
|
# 2. Navigate to your website directory
|
||||||
cd /var/www/atom-nexst/
|
cd /var/www/atom-nexst/
|
||||||
|
|
||||||
# Point Git directly to the local Gitea folder path
|
# Point Git directly to the local Gitea folder path
|
||||||
git remote set-url origin /docker/gitea/gitea/git/repositories/remco/epicnext-cms.git/
|
git remote set-url origin /docker/gitea/gitea/git/repositories/remco/epicnext-cms.git/
|
||||||
|
|
||||||
# 3. Fetch and update code as root to bypass folder permission blocks
|
# 3. Fetch and update code
|
||||||
git fetch origin --prune
|
git fetch origin --prune
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
|
|
||||||
# Fix ownership: Ensure www-data owns the files for the web server
|
# Optioneel: Verwijder de oude build map om caching problemen te voorkomen
|
||||||
sudo chown -R www-data:www-data /var/www/atom-nexst/
|
rm -rf .next
|
||||||
|
|
||||||
# 4. Configure pnpm to automatically approve build scripts for dependencies
|
# 4. Configure pnpm to automatically approve build scripts
|
||||||
pnpm config set trusted-dependencies @parcel/watcher,@swc/core,sharp
|
pnpm config set trusted-dependencies @parcel/watcher,@swc/core,sharp
|
||||||
|
|
||||||
# Install dependencies, run migrations, and build the application
|
# Install dependencies, run migrations, and build the application
|
||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
pnpm db:migrate
|
pnpm db:migrate
|
||||||
pnpm prisma generate
|
pnpm prisma generate
|
||||||
pnpm build
|
pnpm build
|
||||||
|
|
||||||
# 5. Restart the application service
|
# 5. Fix ownership: Eerst bouwen, DAARNA pas alle rechten naar de webserver zetten
|
||||||
|
sudo chown -R www-data:www-data /var/www/atom-nexst/
|
||||||
|
|
||||||
|
# 6. Restart the application service
|
||||||
|
echo "Restarting service..."
|
||||||
sudo systemctl restart atom-nexst.service
|
sudo systemctl restart atom-nexst.service
|
||||||
|
|
||||||
echo "--- Deployment successfully completed ---"
|
# Extra check: Controleer of de service echt goed draait
|
||||||
|
sleep 2
|
||||||
|
if ! systemctl is-active --quiet atom-nexst.service; then
|
||||||
|
echo "ERROR: atom-nexst.service failed to start!" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "--- Deployment successfully completed ---"
|
||||||
Reference in new issue
Block a user