58 lines
1.6 KiB
YAML
58 lines
1.6 KiB
YAML
---
|
|
# Frontend Deployment Tasks
|
|
|
|
- name: Check if frontend source exists
|
|
local_action:
|
|
module: stat
|
|
path: "{{ sigvild_gallery_local_project_path }}/sigvild-kit"
|
|
register: frontend_source
|
|
become: no
|
|
tags: [frontend, build]
|
|
|
|
- name: Fail if frontend source doesn't exist
|
|
fail:
|
|
msg: "Frontend source directory not found at {{ sigvild_gallery_local_project_path }}/sigvild-kit"
|
|
when: not frontend_source.stat.exists
|
|
tags: [frontend, build]
|
|
|
|
- name: Install frontend dependencies
|
|
local_action:
|
|
module: shell
|
|
cmd: npm install
|
|
chdir: "{{ sigvild_gallery_local_project_path }}/sigvild-kit"
|
|
become: no
|
|
tags: [frontend, build]
|
|
|
|
- name: Build frontend for production
|
|
local_action:
|
|
module: shell
|
|
cmd: npm run build:production
|
|
chdir: "{{ sigvild_gallery_local_project_path }}/sigvild-kit"
|
|
become: no
|
|
tags: [frontend, build]
|
|
|
|
- name: Check if frontend build exists
|
|
local_action:
|
|
module: stat
|
|
path: "{{ sigvild_gallery_local_project_path }}/sigvild-kit/build"
|
|
register: frontend_build
|
|
become: no
|
|
tags: [frontend, build]
|
|
|
|
- name: Fail if frontend build doesn't exist
|
|
fail:
|
|
msg: "Frontend build failed - build directory not found"
|
|
when: not frontend_build.stat.exists
|
|
become: no
|
|
tags: [frontend, build]
|
|
|
|
- name: Sync frontend files to web root
|
|
synchronize:
|
|
src: "{{ sigvild_gallery_local_project_path }}/sigvild-kit/build/"
|
|
dest: "{{ sigvild_gallery_web_root }}/"
|
|
delete: yes
|
|
rsync_opts:
|
|
- "--exclude=.git"
|
|
- "--chown={{ sigvild_gallery_user }}:{{ sigvild_gallery_user }}"
|
|
tags: [frontend]
|