-
Notifications
You must be signed in to change notification settings - Fork 28
/
release.yml
47 lines (41 loc) · 1.47 KB
/
release.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
---
- name: release collection
hosts: localhost
gather_facts: no
connection: local
vars:
collection_namespace: "servicenow"
collection_name: servicenow
collection_version: "{{ github_tag.split('/')[-1] | regex_search('(\\d.\\d.\\d.*)') }}"
collection_repo: https://github.com/ServiceNowITOM/servicenow-ansible
api_key: undef
tasks:
- name: create galaxy.yml
template:
src: "{{ playbook_dir}}/galaxy.yml.j2"
dest: "{{ playbook_dir }}/galaxy.yml"
- name: build collection
command:
cmd: ansible-galaxy collection build
chdir: "{{ playbook_dir }}"
creates: "{{ playbook_dir }}/{{ collection_namespace }}-{{ collection_name }}-{{ collection_version }}.tar.gz"
tags: build
- name: install collection
command:
cmd: "ansible-galaxy collection install {{ collection_namespace }}-{{ collection_name }}-{{ collection_version }}.tar.gz -p ~/.ansible/collections/"
chdir: "{{ playbook_dir }}"
tags: install
- name: publish collection
command:
cmd: "ansible-galaxy collection publish --api-key={{ api_key }} {{ collection_namespace }}-{{ collection_name }}-{{ collection_version }}.tar.gz"
chdir: "{{ playbook_dir }}"
tags: publish
- name: git cleanup
command:
cmd: git reset --hard
tags: cleanup
- name: remove galaxy.yml
file:
path: "{{ playbook_dir }}/galaxy.yml"
state: absent
tags: cleanup