From 1a4250022f0675f2885943df842336e0bccfb92a Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Sat, 6 Jul 2024 15:48:25 -0500 Subject: [PATCH] ci: use jq instead of deno eval [take 2] --- .github/workflows/ci_package.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_package.yml b/.github/workflows/ci_package.yml index 1308691e..e97a53c3 100644 --- a/.github/workflows/ci_package.yml +++ b/.github/workflows/ci_package.yml @@ -86,7 +86,7 @@ jobs: - run: deno doc --lint mod.ts - name: deno publish --dry-run run: | - SLOW_TYPES="$(deno eval 'console.log(JSON.parse(Deno.readTextFileSync(`deno.jsonc`))?.types === `slow` ? `--allow-slow-types`: ``)')" + SLOW_TYPES="$(jq -r 'if .types == "slow" then "--allow-slow-types" else "" end' deno.jsonc)" deno publish --dry-run --quiet --allow-dirty $SLOW_TYPES codeql: name: Code quality @@ -143,11 +143,11 @@ jobs: - name: Check package requirements id: package run: | - echo "has_build=$(deno eval 'console.log(!!JSON.parse(Deno.readTextFileSync(`deno.jsonc`))?.tasks?.build || ``)')" >> "$GITHUB_OUTPUT" - echo "has_bench=$(deno eval 'console.log(!!JSON.parse(Deno.readTextFileSync(`deno.jsonc`))?.tasks?.bench || ``)')" >> "$GITHUB_OUTPUT" - echo "has_npm=$(deno eval 'console.log(!!JSON.parse(Deno.readTextFileSync(`deno.jsonc`))?.npm || ``)')" >> "$GITHUB_OUTPUT" - echo "has_x=$(deno eval 'console.log(!!JSON.parse(Deno.readTextFileSync(`deno.jsonc`))?.[`deno.land/x`] || ``)')" >> "$GITHUB_OUTPUT" - echo "slow_types=$(deno eval 'console.log(JSON.parse(Deno.readTextFileSync(`deno.jsonc`))?.types === `slow` ? `--allow-slow-types`: ``)')" >> "$GITHUB_OUTPUT" + echo "has_build=$(jq -r 'if .tasks.build then "run" else empty end' deno.jsonc)" >> "$GITHUB_OUTPUT" + echo "has_bench=$(jq -r 'if .tasks.bench then "run" else empty end' deno.jsonc)" >> "$GITHUB_OUTPUT" + echo "has_npm=$(jq -r 'if .npm then "run" else empty end' deno.jsonc)" >> "$GITHUB_OUTPUT" + echo "has_x=$(jq -r 'if .["deno.land/x"] then "run" else empty end' deno.jsonc)" >> "$GITHUB_OUTPUT" + echo "slow_types=$(jq -r 'if .types == "slow" then "run" else empty end' deno.jsonc)" >> "$GITHUB_OUTPUT" # Build - run: deno task build if: ${{ steps.package.outputs.has_build }} @@ -222,7 +222,7 @@ jobs: git pull --rebase git push origin '${{ needs.test.outputs.tag }}' # Publish - - run: deno publish ${{ needs.test.outputs.slow_types }} + - run: deno publish ${{ needs.test.outputs.slow_types && '--allow-slow-types' || '' }} working-directory: ${{ inputs.package }} shell: bash - name: Run npm publish