ci: fix parsing covector ouput (#8240)

This commit is contained in:
Amr Bashir 2023-11-19 13:54:05 +02:00 committed by GitHub
parent d8f1b6c59b
commit 26ccfef999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 23 deletions

View File

@ -116,15 +116,17 @@ jobs:
event-type: update-docs
- name: Get `@tauri-apps/cli` release id
uses: actions/github-script@v6
id: cliReleaseId
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, '@tauri-apps/cli')
run: |
echo '${{ steps.covector.outputs }}' > output.json
id=$(jq '.["-tauri-apps-cli-releaseId"]' < output.json)
rm output.json
echo "cliReleaseId=$id" >> "$GITHUB_OUTPUT"
with:
result-encoding: string
script: |
const output = `${{ toJSON(steps.covector.outputs) }}`;
const [_, id] = /"-tauri-apps-cli-releaseId": "([0-9]+)"/g.exec(output);
return id;
- name: Trigger `@tauri-apps/cli` publishing workflow
if: |
@ -135,7 +137,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.cliReleaseId.outputs.result }}" }'
- name: Trigger `tauri-cli` publishing workflow
if: |

View File

@ -115,14 +115,18 @@ jobs:
repository: tauri-apps/tauri-docs
event-type: update-docs
- name: Process covector output
id: covectorOutput
- name: Get `@tauri-apps/cli` release id
uses: actions/github-script@v6
id: cliReleaseId
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, '@tauri-apps/cli')
run: |
id=$(node .scripts/covector/parse-output.js '${{ toJSON(steps.covector.outputs) }}' "-tauri-apps-cli-releaseId")
echo "cliReleaseId=$id" >> "$GITHUB_OUTPUT"
with:
result-encoding: string
script: |
const output = `${{ toJSON(steps.covector.outputs) }}`;
const [_, id] = /"-tauri-apps-cli-releaseId": "([0-9]+)"/g.exec(output);
return id;
- name: Trigger `@tauri-apps/cli` publishing workflow
if: |
@ -133,7 +137,7 @@ jobs:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri
event-type: publish-js-cli
client-payload: '{"releaseId": "${{ steps.covectorOutput.outputs.cliReleaseId }}" }'
client-payload: '{"releaseId": "${{ steps.cliReleaseId.outputs.result }}" }'
- name: Trigger `tauri-cli` publishing workflow
if: |

View File

@ -1,11 +0,0 @@
#!/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])