43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
name: Local Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: shell
|
|
|
|
steps:
|
|
- name: Run Deploy Scripts Locally
|
|
run: |
|
|
set -e
|
|
echo "--- EPIC WEB CONTROL: Starting Auto-Cleanup & Deploy ---"
|
|
|
|
# 1. Clean up unused build images safely instead of deleting stopped containers
|
|
docker image prune -f
|
|
|
|
# 2. Navigate to your website directory
|
|
cd /var/www/atom-nexst/
|
|
|
|
# Point Git directly to the local Gitea folder path
|
|
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
|
|
git fetch origin --prune
|
|
git reset --hard origin/main
|
|
|
|
# Fix ownership: Ensure www-data owns the files for the web server
|
|
sudo chown -R www-data:www-data /var/www/atom-nexst/
|
|
|
|
# 4. Install dependencies, run migrations, and build the application
|
|
pnpm install --frozen-lockfile
|
|
pnpm db:migrate
|
|
pnpm prisma generate
|
|
pnpm build
|
|
|
|
# 5. Restart the application service
|
|
sudo systemctl restart atom-nexst.service
|
|
|
|
echo "--- Deployment successfully completed ---" |