Adrià Vilanova Martínez | a7d7f8d | 2022-01-16 12:33:57 +0100 | [diff] [blame] | 1 | - name: Check extension_id, credentials.clientId, credentials.refreshToken are set |
| 2 | when: > |
| 3 | extension_id is not defined or credentials.clientId is not defined or |
| 4 | credentials.refreshToken is not defined |
| 5 | fail: |
| 6 | msg: "extension_id, credentials.clientId and credentials.refreshToken must be set" |
| 7 | |
| 8 | - name: Build extension |
| 9 | include_role: |
| 10 | name: build-extension |
| 11 | vars: |
| 12 | make_target: release_chromium_canary |
| 13 | |
| 14 | - name: Get name of the compiled ZIP file |
| 15 | ansible.builtin.shell: |
| 16 | cmd: "ls -Art | tail -n 1" |
| 17 | chdir: "{{ zuul.project.src_dir }}/out" |
| 18 | register: zip_file |
| 19 | |
| 20 | - name: Check the ZIP file name is non-empty |
| 21 | when: zip_file.stdout == "" |
| 22 | fail: |
| 23 | msg: "zip_file.stdout is empty" |
| 24 | |
| 25 | - name: Print ZIP file name |
| 26 | when: not (zip_file.stdout == "") |
| 27 | debug: |
| 28 | msg: "zip_file.stdout is \"{{ zip_file.stdout }}\"" |
| 29 | |
| 30 | - name: Upload and publish the ZIP file to the Chrome Web Store |
| 31 | when: not (dry_run|bool) |
Adrià Vilanova Martínez | c2c3c36 | 2022-01-17 00:45:05 +0100 | [diff] [blame] | 32 | ansible.builtin.shell: |
Adrià Vilanova Martínez | 2a8c074 | 2022-01-17 16:54:17 +0100 | [diff] [blame] | 33 | cmd: | |
Adrià Vilanova Martínez | 60db978 | 2022-01-17 20:38:29 +0100 | [diff] [blame] | 34 | set -o pipefail |
Adrià Vilanova Martínez | 2a8c074 | 2022-01-17 16:54:17 +0100 | [diff] [blame] | 35 | chrome-webstore-upload upload --auto-publish --extension-id {{ extension_id }} \ |
Adrià Vilanova Martínez | cd9a9c5 | 2022-02-02 18:26:49 +0100 | [diff] [blame] | 36 | --trusted-testers --source {{ zip_file.stdout|quote }} \ |
Adrià Vilanova Martínez | 2a8c074 | 2022-01-17 16:54:17 +0100 | [diff] [blame] | 37 | --client-id {{ credentials.clientId|quote }} \ |
| 38 | --refresh-token {{ credentials.refreshToken|quote }} \ |
Adrià Vilanova Martínez | 9f884e8 | 2022-01-17 20:11:29 +0100 | [diff] [blame] | 39 | 2>&1 | tee cws-log.txt |
Adrià Vilanova Martínez | de736be | 2022-01-17 01:23:03 +0100 | [diff] [blame] | 40 | chdir: "{{ zuul.project.src_dir }}/out" |
Adrià Vilanova Martínez | 60db978 | 2022-01-17 20:38:29 +0100 | [diff] [blame] | 41 | executable: /bin/bash |
Adrià Vilanova Martínez | a7d7f8d | 2022-01-16 12:33:57 +0100 | [diff] [blame] | 42 | no_log: True |
Adrià Vilanova Martínez | a8341d0 | 2022-01-17 00:18:30 +0100 | [diff] [blame] | 43 | register: uploadcmd |
Adrià Vilanova Martínez | 8482373 | 2022-02-05 00:56:31 +0100 | [diff] [blame] | 44 | failed_when: false |
| 45 | |
Adrià Vilanova Martínez | d037f40 | 2022-03-26 19:30:50 +0100 | [diff] [blame] | 46 | - name: Read upload log |
| 47 | when: not (dry_run|bool) |
| 48 | ansible.builtin.shell: |
| 49 | cmd: cat cws-log.txt |
| 50 | chdir: "{{ zuul.project.src_dir }}/out" |
| 51 | executable: /bin/bash |
| 52 | register: uploadlog |
| 53 | |
Adrià Vilanova Martínez | 8482373 | 2022-02-05 00:56:31 +0100 | [diff] [blame] | 54 | - name: Check whether the upload was successful |
Adrià Vilanova Martínez | d037f40 | 2022-03-26 19:30:50 +0100 | [diff] [blame] | 55 | when: "not (dry_run|bool) and not (uploadcmd.rc == 0 or ('ITEM_NOT_UPDATABLE' in uploadlog.stdout) or ('PKG_INVALID_VERSION_NUMBER') in uploadlog.stdout)" |
Adrià Vilanova Martínez | 8482373 | 2022-02-05 00:56:31 +0100 | [diff] [blame] | 56 | fail: |
Adrià Vilanova Martínez | d037f40 | 2022-03-26 19:30:50 +0100 | [diff] [blame] | 57 | msg: "{{ uploadlog.stdout }}" |