This repository has been archived by the owner on Nov 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplay.yml
169 lines (147 loc) · 5.39 KB
/
play.yml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
---
- name: "chocomilk"
hosts: all
connection: local
gather_facts: false
vars:
force_update: false
pwd: "{{ lookup('env','PWD') }}"
pre_tasks:
- name: "Search package directory"
find:
paths: "{{ pwd }}"
recurse: false
file_type: directory
excludes: "chocomilk"
register: register_package_directory
- name: "Search .nuspec file"
find:
paths: "{{ pwd }}"
recurse: true
patterns: "*.nuspec"
hidden: true
register: register_nuspec_file
- name: "Search .milk file"
find:
paths: "{{ pwd }}"
recurse: true
patterns: ".milk.yml"
hidden: true
register: register_milk_path
- name: "Search chocolateyinstall file"
find:
paths: "{{ pwd }}"
recurse: true
patterns: "*chocolateyinstall.ps1"
hidden: true
register: register_chocolateyinstall_path
- name: "Search README file"
find:
paths: "{{ register_package_directory.files[0].path }}"
recurse: true
patterns: "*README*"
hidden: true
register: register_readme_path
- name: "Search package id"
xml:
path: "{{ register_nuspec_file.files[0].path }}"
namespaces:
ns: "http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"
xpath: /ns:package/ns:metadata/ns:id
content: text
register: register_package_id
- name: "Search package title"
xml:
path: "{{ register_nuspec_file.files[0].path }}"
namespaces:
ns: "http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"
xpath: /ns:package/ns:metadata/ns:title
content: text
register: register_package_title
- name: "Search pre-tasks file"
find:
paths: "{{ register_package_directory.files[0].path }}/.milk"
recurse: true
hidden: true
file_type: directory
register: register_pretasks_path
- name: "Search after-tasks file"
find:
paths: "{{ register_package_directory.files[0].path }}/.milk"
recurse: true
patterns: "*aftertasks*"
hidden: true
register: register_aftertasks_path
- name: "Sets search info"
set_fact:
path_package: "{{ register_package_directory.files[0].path }}"
path_nuspec: "{{ register_nuspec_file.files[0].path }}"
path_chocolateyinstall: "{{ register_chocolateyinstall_path.files[0].path }}"
path_milk: "{{ register_milk_path.files[0].path }}"
path_readme: "{{ register_readme_path.files[0].path }}"
package_id: '{{ register_package_id.matches[0]["{http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd}id"] }}'
package_title: '{{ register_package_title.matches[0]["{http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd}title"] }}'
- name: "Sets search info"
set_fact:
path_pretasks: "{{ register_pretasks_path.files[0].path | default(omit) }}"
when: register_pretasks_path.files
- name: "Sets search info"
set_fact:
path_aftertasks: "{{ register_aftertasks_path.files[0].path | default(omit) }}"
when: register_aftertasks_path.files
- name: "include .milk vars"
include_vars:
file: "{{ path_milk }}"
tasks:
# Check new Version
- name: "{{ package_id }} : include check new version"
include_tasks: package/version.yml
- block:
- name: "include pre-tasks"
include_tasks: "{{ path_pretasks }}"
when: path_pretasks is defined and path_pretasks
# File Hash
- name: "{{ package_id }} : include file hash"
include_tasks: package/file_hash.yml
loop:
- "{{ url }}"
- "{{ url64 | default(false) }}"
when: loop_file_hash is defined and loop_file_hash
loop_control:
loop_var: loop_file_hash
- name: "{{ package_id }} : include searchreplace"
include_tasks: package/searchreplace.yml
loop: "{{ searchreplace | dict2items }}"
loop_control:
loop_var: loop_searchreplace
- name: "{{ package_id }} : include nuspec"
include_tasks: package/nuspec.yml
- name: "{{ package_id }} : create package"
become: true
docker_container:
auto_remove: true
name: choco_pack
image: "linuturk/mono-choco"
command: "pack -vd {{ package_id }}.nuspec --outputdirectory {{ path_package }}"
working_dir: "{{ path_package }}/package"
volumes:
- "{{ path_package }}:{{ path_package }}"
- name: "include after-tasks"
include_tasks: "{{ path_aftertasks }}"
when: path_aftertasks is defined and path_aftertasks
- name: "{{ package_id }} : load deploy"
include_tasks: deploy/{{ loop_deploy.provider }}.yml
loop_control:
loop_var: loop_deploy
loop: "{{ deploy | flatten(levels=1) }}"
tags:
- deployment
- name: "{{ package_id }} : load notifications"
include_tasks: notifications/{{ loop_notifications.provider }}.yml
loop_control:
loop_var: loop_notifications
when: loop_notifications is defined and loop_notifications
loop: "{{ notifications | flatten(levels=1) }}"
tags:
- notifications
when: force_update | bool