From bab05ff60700d54ff6dd7b4c0f4070d630d9ddd1 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Wed, 11 Oct 2023 12:53:01 -0300 Subject: [PATCH] fix(ci): properly detect @tauri-apps/cli release id from covector output (#8004) --- .github/workflows/covector-version-or-publish.yml | 10 ++++------ .scripts/covector/parse-output.js | 11 +++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 .scripts/covector/parse-output.js diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml index ecce56af2e0b..e4a91586a2e6 100644 --- a/.github/workflows/covector-version-or-publish.yml +++ b/.github/workflows/covector-version-or-publish.yml @@ -115,15 +115,13 @@ jobs: repository: tauri-apps/tauri-docs event-type: update-docs - - name: Get `@tauri-apps/cli` release id - id: cliReleaseId + - name: Process covector output + id: covectorOutput if: | steps.covector.outputs.successfulPublish == 'true' && contains(steps.covector.outputs.packagesPublished, '@tauri-apps/cli') run: | - echo '${{ toJSON(steps.covector.outputs) }}' > output.json - id=$(jq '.["-tauri-apps-cli-releaseId"]' < output.json) - rm output.json + id=$(node .scripts/covector/parse-output.js '${{ toJSON(steps.covector.outputs) }}' "-tauri-apps-cli-releaseId") echo "cliReleaseId=$id" >> "$GITHUB_OUTPUT" - name: Trigger `@tauri-apps/cli` publishing workflow @@ -135,7 +133,7 @@ jobs: token: ${{ secrets.ORG_TAURI_BOT_PAT }} repository: tauri-apps/tauri event-type: publish-js-cli - client-payload: '{"releaseId": "${{ steps.cliReleaseId.outputs.cliReleaseId }}" }' + client-payload: '{"releaseId": "${{ steps.covectorOutput.outputs.cliReleaseId }}" }' - name: Trigger `tauri-cli` publishing workflow if: | diff --git a/.scripts/covector/parse-output.js b/.scripts/covector/parse-output.js new file mode 100644 index 000000000000..4c1747de6f85 --- /dev/null +++ b/.scripts/covector/parse-output.js @@ -0,0 +1,11 @@ +#!/usr/bin/env node + +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +const json = process.argv[2] +const field = process.argv[3] + +const output = JSON.parse(json) +console.log(output[field])