From 42c765cc3c71816b3ab1308e10eefed6e97411d3 Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Sat, 6 Jul 2024 16:37:36 -0500 Subject: [PATCH] chore: clean up pipelines Always set the shell explicitly. Otherwise, it might not be bash. It also won't have pipefail. I also swapped a few &&s for multiline strings. --- .github/workflows/ci.yml | 13 ++++++++++-- .github/workflows/ci_package.yml | 36 +++++++++++++++++++------------- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 345b360a..866390bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,11 @@ on: concurrency: group: ${{ github.ref }} cancel-in-progress: true + +defaults: + run: + shell: bash + jobs: setup: name: Setup @@ -101,7 +106,9 @@ jobs: ref: main - uses: denoland/setup-deno@v1 - name: Configure git - run: git config user.name 'github-actions[bot]' && git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + run: | + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - name: Run deno task make:config run: | deno task make:config @@ -154,7 +161,9 @@ jobs: fetch-depth: 0 - uses: denoland/setup-deno@v1 - name: Configure git - run: git config user.name 'github-actions[bot]' && git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + run: | + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' # Publish - name: Run deno.land/x publish run: deno run --allow-all jsr:@libs/bundle/ts/cli/publish deno.jsonc --loglevel debug --x.repository '${{ github.repository }}' --x.token '${{ secrets.GH_TOKEN }}' --x.version "$(date '+%Y.%m.%d')" --x.map deno.jsonc --x.reactive --x.remove diff --git a/.github/workflows/ci_package.yml b/.github/workflows/ci_package.yml index 1fef2757..1308691e 100644 --- a/.github/workflows/ci_package.yml +++ b/.github/workflows/ci_package.yml @@ -49,6 +49,11 @@ on: GH_TOKEN: description: GitHub token required: true + +defaults: + run: + shell: bash + jobs: setup: name: Setup @@ -69,17 +74,17 @@ jobs: if: (inputs.ref == 'refs/heads/main' && inputs.event == 'push') || (needs.setup.outputs.edited == 'true') runs-on: ubuntu-latest needs: setup + defaults: + run: + shell: bash + steps: - uses: actions/checkout@v4 - uses: denoland/setup-deno@v1 - run: deno lint - working-directory: ${{ inputs.package }} - run: deno fmt --check - working-directory: ${{ inputs.package }} - run: deno doc --lint mod.ts - working-directory: ${{ inputs.package }} - name: deno publish --dry-run - working-directory: ${{ inputs.package }} run: | SLOW_TYPES="$(deno eval 'console.log(JSON.parse(Deno.readTextFileSync(`deno.jsonc`))?.types === `slow` ? `--allow-slow-types`: ``)')" deno publish --dry-run --quiet --allow-dirty $SLOW_TYPES @@ -90,6 +95,10 @@ jobs: needs: setup permissions: security-events: write + defaults: + run: + shell: bash + steps: - uses: actions/checkout@v4 - uses: github/codeql-action/init@v3 @@ -113,6 +122,10 @@ jobs: slow_types: ${{ steps.package.outputs.slow_types }} tag: ${{ steps.tag.outputs.tag }} version: ${{ steps.tag.outputs.semver }} + defaults: + run: + shell: bash + steps: # Setup - uses: actions/checkout@v4 @@ -135,22 +148,16 @@ jobs: 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" - working-directory: ${{ inputs.package }} # Build - run: deno task build if: ${{ steps.package.outputs.has_build }} - working-directory: ${{ inputs.package }} # Tests - run: deno task test:deno - working-directory: ${{ inputs.package }} - run: deno task test:deno-future - working-directory: ${{ inputs.package }} - run: deno task test:others - working-directory: ${{ inputs.package }} # Bench - run: deno task bench if: ${{ steps.package.outputs.has_bench }} - working-directory: ${{ inputs.package }} # Tag - id: tag if: inputs.ref == 'refs/heads/main' && inputs.event == 'push' @@ -171,6 +178,10 @@ jobs: id-token: write contents: write packages: write + defaults: + run: + shell: bash + steps: # Setup - uses: actions/checkout@v4 @@ -192,7 +203,6 @@ jobs: git pull --rebase git push fi - working-directory: ${{ inputs.package }} # Tag - name: Run deno task tag if: ${{ needs.test.outputs.tag }} @@ -211,15 +221,13 @@ jobs: git show-ref --tags '${{ needs.test.outputs.tag }}' git pull --rebase git push origin '${{ needs.test.outputs.tag }}' - working-directory: ${{ inputs.package }} # Publish - run: deno publish ${{ needs.test.outputs.slow_types }} working-directory: ${{ inputs.package }} + shell: bash - name: Run npm publish if: ${{ needs.test.outputs.has_npm }} run: deno run --allow-all jsr:@libs/bundle/ts/cli/publish deno.jsonc --loglevel debug --npm.registry 'https://registry.npmjs.org' --npm.token '${{ secrets.NPM_TOKEN }}' --npm.scope '@lowlighter' --npm.access public - working-directory: ${{ inputs.package }} - name: Run deno.land/x publish if: ${{ needs.test.outputs.has_x }} run: deno run --allow-all jsr:@libs/bundle/ts/cli/publish deno.jsonc --loglevel debug --x.repository '${{ github.repository }}' --x.token '${{ secrets.GH_TOKEN }}' --x.directory="$(git rev-parse --show-prefix)" --x.map deno.jsonc --x.reactive --x.remove - working-directory: ${{ inputs.package }}