@dword-design/base-config-app 9.0.6 → 9.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -1
- package/dist/playbook.yml +14 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
+
import pathLib from "node:path";
|
|
2
3
|
import { defineBaseConfig } from "@dword-design/base";
|
|
3
4
|
import getBaseConfigNuxt, { getEslintConfig } from "@dword-design/base-config-nuxt";
|
|
4
5
|
import packageName from "depcheck-package-name";
|
|
@@ -55,7 +56,7 @@ export default defineBaseConfig(function (config) {
|
|
|
55
56
|
run: "pnpm build"
|
|
56
57
|
}, {
|
|
57
58
|
name: "Create deploy artifact",
|
|
58
|
-
run:
|
|
59
|
+
run: `tar -czf deploy.tgz .output${fs.existsSync(pathLib.join(this.cwd, ".env.schema.json")) ? " .env.schema.json" : ""} ecosystem.json`
|
|
59
60
|
}, {
|
|
60
61
|
name: "Install Python",
|
|
61
62
|
uses: "actions/setup-python@v4",
|
package/dist/playbook.yml
CHANGED
|
@@ -19,38 +19,35 @@
|
|
|
19
19
|
- name: Prepare deploy folder layout and compute new release path
|
|
20
20
|
community.general.deploy_helper:
|
|
21
21
|
path: "{{ deploy_to }}"
|
|
22
|
-
release: "{{ release_id | default(ansible_date_time.iso8601_basic_short) }}"
|
|
23
|
-
state: present
|
|
24
|
-
register: dh
|
|
25
22
|
|
|
26
23
|
- name: Upload artifact to server
|
|
27
24
|
ansible.builtin.copy:
|
|
28
25
|
src: "{{ artifact_local_path }}"
|
|
29
|
-
dest: "/tmp/{{ app_name }}-{{
|
|
26
|
+
dest: "/tmp/{{ app_name }}-{{ deploy_helper.new_release }}.tgz"
|
|
30
27
|
mode: "0644"
|
|
31
28
|
|
|
32
29
|
- name: Ensure new release directory exists
|
|
33
30
|
ansible.builtin.file:
|
|
34
|
-
path: "{{
|
|
31
|
+
path: "{{ deploy_helper.new_release_path }}"
|
|
35
32
|
state: directory
|
|
36
33
|
mode: "0755"
|
|
37
34
|
|
|
38
35
|
- name: Extract artifact into new release path
|
|
39
36
|
ansible.builtin.unarchive:
|
|
40
|
-
src: "/tmp/{{ app_name }}-{{
|
|
41
|
-
dest: "{{
|
|
37
|
+
src: "/tmp/{{ app_name }}-{{ deploy_helper.new_release }}.tgz"
|
|
38
|
+
dest: "{{ deploy_helper.new_release_path }}"
|
|
42
39
|
remote_src: true
|
|
43
40
|
|
|
44
41
|
# --- AUTO-LINK: link all direct children of shared/ into the release root ---
|
|
45
42
|
- name: Ensure shared directory exists
|
|
46
43
|
ansible.builtin.file:
|
|
47
|
-
path: "{{
|
|
44
|
+
path: "{{ deploy_helper.shared_path }}"
|
|
48
45
|
state: directory
|
|
49
46
|
mode: "0755"
|
|
50
47
|
|
|
51
48
|
- name: List all items in shared/ (including dotfiles)
|
|
52
49
|
ansible.builtin.find:
|
|
53
|
-
paths: "{{
|
|
50
|
+
paths: "{{ deploy_helper.shared_path }}"
|
|
54
51
|
file_type: any
|
|
55
52
|
hidden: true
|
|
56
53
|
recurse: false
|
|
@@ -59,28 +56,31 @@
|
|
|
59
56
|
- name: Symlink all shared items into the new release (same name)
|
|
60
57
|
ansible.builtin.file:
|
|
61
58
|
src: "{{ item.path }}"
|
|
62
|
-
dest: "{{
|
|
59
|
+
dest: "{{ deploy_helper.new_release_path }}/{{ item.path | basename }}"
|
|
63
60
|
state: link
|
|
64
61
|
force: true
|
|
65
62
|
loop: "{{ shared_items.files }}"
|
|
66
63
|
|
|
67
64
|
# Optional server-side steps go here (migrations, perms, etc.)
|
|
68
65
|
# - name: Run migrations
|
|
69
|
-
# ansible.builtin.command: "{{
|
|
66
|
+
# ansible.builtin.command: "{{ deploy_helper.new_release_path }}/bin/migrate"
|
|
70
67
|
# changed_when: true
|
|
71
68
|
|
|
72
69
|
- name: "Finalize: switch current -> new release (atomic)"
|
|
73
70
|
community.general.deploy_helper:
|
|
74
71
|
path: "{{ deploy_to }}"
|
|
75
|
-
release: "{{
|
|
72
|
+
release: "{{ deploy_helper.new_release }}"
|
|
76
73
|
state: finalize
|
|
77
74
|
|
|
78
75
|
- name: Restart app
|
|
79
|
-
ansible.builtin.
|
|
76
|
+
ansible.builtin.shell: source ~/.nvm/nvm.sh && pm2 startOrReload ecosystem.json
|
|
77
|
+
args:
|
|
78
|
+
chdir: "{{ deploy_helper.new_release_path }}"
|
|
79
|
+
executable: /bin/bash
|
|
80
80
|
changed_when: true
|
|
81
81
|
|
|
82
82
|
- name: Cleanup old releases
|
|
83
83
|
community.general.deploy_helper:
|
|
84
84
|
path: "{{ deploy_to }}"
|
|
85
85
|
keep_releases: 5
|
|
86
|
-
state:
|
|
86
|
+
state: clean
|