Skip to content

Commit

Permalink
ci: use jq instead of deno eval [take 2]
Browse files Browse the repository at this point in the history
  • Loading branch information
lishaduck committed Jul 7, 2024
1 parent 42c765c commit 1a42500
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1a42500

Please sign in to comment.