src.nth.io/

summaryrefslogtreecommitdiff
path: root/mattertimesync/build/tasks/main.yaml
blob: e846f9cb8e03e4579bd69f0f8b8ea7d9150d0f68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---

- name: unarchive mattertimesync source
  unarchive:
    remote_src: yes
    src: "{{mattertimesync_tar}}"
    dest: "{{build_work_dir}}/"
    creates: "{{mattertimesync_build_dir}}"

- name: check if mattertimesync build exists
  stat:
    path: "{{mattertimesync_srv_dir}}/mattertimesync-{{mattertimesync_version}}.tar.gz"
  register: build_file

- name: install mattertimesync build dependencies
  command: "npm ci"
  args:
    chdir: "{{mattertimesync_build_dir}}"
  when: not build_file.stat.exists

- name: bundle mattertimesync
  command: "npm run bundle"
  args:
    chdir: "{{mattertimesync_build_dir}}"
    creates: "{{mattertimesync_build_dir}}/mattertimesync.mjs"
  when: not build_file.stat.exists

- name: create build server dir
  become: yes
  file:
    path: "{{mattertimesync_srv_dir}}"
    mode: "0755"
    state: "directory"

- name: create gz archive of mattertimesync bundle
  become: yes
  archive:
    path: "{{mattertimesync_build_dir}}/mattertimesync.mjs"
    dest: "{{mattertimesync_srv_dir}}/mattertimesync-{{mattertimesync_version}}.tar.gz"
    format: "gz"
    # force a real tar for the single-file bundle; the module otherwise gzips a
    # lone file into a bare .gz that the server's unarchive can't extract.
    force_archive: true
  when: not build_file.stat.exists