src.nth.io/

summaryrefslogtreecommitdiff
path: root/mattertimesync/build
diff options
context:
space:
mode:
Diffstat (limited to 'mattertimesync/build')
-rw-r--r--mattertimesync/build/defaults/main.yaml9
-rw-r--r--mattertimesync/build/meta/main.yaml4
-rw-r--r--mattertimesync/build/tasks/main.yaml41
3 files changed, 54 insertions, 0 deletions
diff --git a/mattertimesync/build/defaults/main.yaml b/mattertimesync/build/defaults/main.yaml
new file mode 100644
index 0000000..96156f8
--- /dev/null
+++ b/mattertimesync/build/defaults/main.yaml
@@ -0,0 +1,9 @@
+---
+
+mattertimesync_version: "0.1.0"
+# https://github.com/lukehoersten/mattertimesync/tags
+# Pure-JS project: npm run bundle produces one self-contained mattertimesync.mjs
+# (no native modules), so the target only needs node to run it.
+mattertimesync_tar: "https://github.com/{{github_user}}/mattertimesync/archive/refs/tags/v{{mattertimesync_version}}.tar.gz"
+mattertimesync_build_dir: "/tmp/mattertimesync-{{mattertimesync_version}}"
+mattertimesync_srv_dir: "{{build_srv_dir}}"
diff --git a/mattertimesync/build/meta/main.yaml b/mattertimesync/build/meta/main.yaml
new file mode 100644
index 0000000..6116998
--- /dev/null
+++ b/mattertimesync/build/meta/main.yaml
@@ -0,0 +1,4 @@
+---
+
+dependencies:
+ - nodejs
diff --git a/mattertimesync/build/tasks/main.yaml b/mattertimesync/build/tasks/main.yaml
new file mode 100644
index 0000000..68c9da0
--- /dev/null
+++ b/mattertimesync/build/tasks/main.yaml
@@ -0,0 +1,41 @@
+---
+
+- name: unarchive mattertimesync source
+ unarchive:
+ remote_src: yes
+ src: "{{mattertimesync_tar}}"
+ dest: "/tmp/"
+ 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"
+ when: not build_file.stat.exists