Adrià Vilanova Martínez | d3620d0 | 2022-06-01 14:39:40 +0200 | [diff] [blame] | 1 | - 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 }} \ |
Adrià Vilanova Martínez | 77eab4a | 2022-06-03 19:56:02 +0200 | [diff] [blame^] | 17 | {% if clientSecret is defined %} --client-secret {{ clientSecret }} {% endif %} \ |
Adrià Vilanova Martínez | d3620d0 | 2022-06-01 14:39:40 +0200 | [diff] [blame] | 18 | 2>&1 | tee cws-log.txt |
| 19 | chdir: "{{ workingDirectory }}" |
| 20 | executable: /bin/bash |
| 21 | no_log: True |
| 22 | register: uploadcmd |
| 23 | failed_when: false |
| 24 | |
| 25 | - name: Read upload log |
| 26 | ansible.builtin.shell: |
| 27 | cmd: cat cws-log.txt |
| 28 | chdir: "{{ workingDirectory }}" |
| 29 | executable: /bin/bash |
| 30 | register: uploadlog |
| 31 | |
| 32 | - name: Check whether the upload was successful |
| 33 | when: "not (uploadcmd.rc == 0 or ('ITEM_NOT_UPDATABLE' in uploadlog.stdout) or ('PKG_INVALID_VERSION_NUMBER') in uploadlog.stdout)" |
| 34 | fail: |
| 35 | msg: "{{ uploadlog.stdout }}" |