Skip to content

Commit

Permalink
chore: clean up pipelines
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lishaduck committed Jul 7, 2024
1 parent 0e96a60 commit 42c765c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
setup:
name: Setup
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
36 changes: 22 additions & 14 deletions .github/workflows/ci_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ on:
GH_TOKEN:
description: GitHub token
required: true

defaults:
run:
shell: bash

jobs:
setup:
name: Setup
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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'
Expand All @@ -171,6 +178,10 @@ jobs:
id-token: write
contents: write
packages: write
defaults:
run:
shell: bash

steps:
# Setup
- uses: actions/checkout@v4
Expand All @@ -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 }}
Expand All @@ -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 }}

0 comments on commit 42c765c

Please sign in to comment.