blob: aaab7a52e11e7226b353fb6a373d03bd5e1ad1e5 [file] [log] [blame]
Adrià Vilanova Martínezd3620d02022-06-01 14:39:40 +02001- name: Check extensionId, clientId, refreshToken, workingDirectory, zipFile are set
2 when: >
3 extensionId is not defined or clientId is not defined or
4 refreshToken is not defined or workingDirectory is not defined or
5 zipFile is not defined
6 fail:
7 msg: "extensionId, clientId, refreshToken, workingDirectory and zipFile must be set"
8
9- name: Upload and publish the ZIP file to the Chrome Web Store
10 ansible.builtin.shell:
11 cmd: |
12 set -o pipefail
13 chrome-webstore-upload upload {{ '--auto-publish' if (autopublish|bool) else '' }} \
14 --extension-id {{ extensionId }} {{ '--trusted-testers' if (trustedTesters|bool) else '' }} \
15 --source {{ zipFile }} --client-id {{ clientId|quote }} \
16 --refresh-token {{ refreshToken|quote }} \
17 2>&1 | tee cws-log.txt
18 chdir: "{{ workingDirectory }}"
19 executable: /bin/bash
20 no_log: True
21 register: uploadcmd
22 failed_when: false
23
24- name: Read upload log
25 ansible.builtin.shell:
26 cmd: cat cws-log.txt
27 chdir: "{{ workingDirectory }}"
28 executable: /bin/bash
29 register: uploadlog
30
31- name: Check whether the upload was successful
32 when: "not (uploadcmd.rc == 0 or ('ITEM_NOT_UPDATABLE' in uploadlog.stdout) or ('PKG_INVALID_VERSION_NUMBER') in uploadlog.stdout)"
33 fail:
34 msg: "{{ uploadlog.stdout }}"