Skip to content

build(deps-dev): bump @sanity/preview-kit from 5.1.23 to 5.1.24 in the sanity group #1413

build(deps-dev): bump @sanity/preview-kit from 5.1.23 to 5.1.24 in the sanity group

build(deps-dev): bump @sanity/preview-kit from 5.1.23 to 5.1.24 in the sanity group #1413

Workflow file for this run

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: "Checks"
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
concurrency: checks-${{ github.ref == 'refs/heads/main' && 'main' || github.event.pull_request.head.sha }}
jobs:
install-node-modules:
name: Install Node Modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4.1.0
with:
node-version-file: "package.json"
cache: "npm"
- id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
packages/*/node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- if: steps.node-modules.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts
- run: npm install --ignore-scripts
- run: |
if [[ $(git status --porcelain) != "" ]]; then
git --no-pager diff --color --text HEAD
exit 1
fi
build:
name: Build
needs: install-node-modules
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- uses: actions/setup-node@v4.1.0
with:
node-version-file: "package.json"
cache: "npm"
- uses: actions/cache/restore@v4
with:
path: |
node_modules
packages/*/node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
fail-on-cache-miss: true
- run: |
DRY_RUN=$(npx turbo run build --dry=json)
HASH_CLIENT_MOCK=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@sanity-typed/client-mock#build\")) | .hash")
HASH_CLIENT=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@sanity-typed/client#build\")) | .hash")
HASH_EXAMPLE_APP=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@sanity-typed/example-app#build\")) | .hash")
HASH_EXAMPLE_STUDIO=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@sanity-typed/example-studio#build\")) | .hash")
HASH_FAKER=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@sanity-typed/faker#build\")) | .hash")
HASH_GROQ_JS=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@sanity-typed/groq-js#build\")) | .hash")
HASH_GROQ=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@sanity-typed/groq#build\")) | .hash")
HASH_NEXT_SANITY=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@sanity-typed/next-sanity#build\")) | .hash")
HASH_PREVIEW_KIT=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@sanity-typed/preview-kit#build\")) | .hash")
HASH_PT_REACT=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@portabletext-typed/react#build\")) | .hash")
HASH_PT_TO_HTML=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@portabletext-typed/to-html#build\")) | .hash")
HASH_PT_TYPES=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@portabletext-typed/types#build\")) | .hash")
HASH_TYPES=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@sanity-typed/types#build\")) | .hash")
HASH_ZOD=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@sanity-typed/zod#build\")) | .hash")
echo "HASH_CLIENT_MOCK=$HASH_CLIENT_MOCK" >> $GITHUB_ENV
echo "HASH_CLIENT=$HASH_CLIENT" >> $GITHUB_ENV
echo "HASH_EXAMPLE_APP=$HASH_EXAMPLE_APP" >> $GITHUB_ENV
echo "HASH_EXAMPLE_STUDIO=$HASH_EXAMPLE_STUDIO" >> $GITHUB_ENV
echo "HASH_FAKER=$HASH_FAKER" >> $GITHUB_ENV
echo "HASH_GROQ_JS=$HASH_GROQ_JS" >> $GITHUB_ENV
echo "HASH_GROQ=$HASH_GROQ" >> $GITHUB_ENV
echo "HASH_NEXT_SANITY=$HASH_NEXT_SANITY" >> $GITHUB_ENV
echo "HASH_PREVIEW_KIT=$HASH_PREVIEW_KIT" >> $GITHUB_ENV
echo "HASH_PT_REACT=$HASH_PT_REACT" >> $GITHUB_ENV
echo "HASH_PT_TO_HTML=$HASH_PT_TO_HTML" >> $GITHUB_ENV
echo "HASH_PT_TYPES=$HASH_PT_TYPES" >> $GITHUB_ENV
echo "HASH_TYPES=$HASH_TYPES" >> $GITHUB_ENV
echo "HASH_ZOD=$HASH_ZOD" >> $GITHUB_ENV
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_CLIENT_MOCK }}*
key: turbo-cache-${{ env.HASH_CLIENT_MOCK }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_CLIENT }}*
key: turbo-cache-${{ env.HASH_CLIENT }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_EXAMPLE_APP }}*
key: turbo-cache-${{ env.HASH_EXAMPLE_APP }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_EXAMPLE_STUDIO }}*
key: turbo-cache-${{ env.HASH_EXAMPLE_STUDIO }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_FAKER }}*
key: turbo-cache-${{ env.HASH_FAKER }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_GROQ_JS }}*
key: turbo-cache-${{ env.HASH_GROQ_JS }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_GROQ }}*
key: turbo-cache-${{ env.HASH_GROQ }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_NEXT_SANITY }}*
key: turbo-cache-${{ env.HASH_NEXT_SANITY }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_PREVIEW_KIT }}*
key: turbo-cache-${{ env.HASH_PREVIEW_KIT }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_PT_REACT }}*
key: turbo-cache-${{ env.HASH_PT_REACT }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_PT_TO_HTML }}*
key: turbo-cache-${{ env.HASH_PT_TO_HTML }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_PT_TYPES }}*
key: turbo-cache-${{ env.HASH_PT_TYPES }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_TYPES }}*
key: turbo-cache-${{ env.HASH_TYPES }}
- uses: actions/cache/restore@v4
with:
path: .turbo/cache/${{ env.HASH_ZOD }}*
key: turbo-cache-${{ env.HASH_ZOD }}
- env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: npm run build
# Whether or not npm run build fails, we want to save the cache when we can
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_CLIENT_MOCK }}*
key: turbo-cache-${{ env.HASH_CLIENT_MOCK }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_CLIENT }}*
key: turbo-cache-${{ env.HASH_CLIENT }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_EXAMPLE_APP }}*
key: turbo-cache-${{ env.HASH_EXAMPLE_APP }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_EXAMPLE_STUDIO }}*
key: turbo-cache-${{ env.HASH_EXAMPLE_STUDIO }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_FAKER }}*
key: turbo-cache-${{ env.HASH_FAKER }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_GROQ_JS }}*
key: turbo-cache-${{ env.HASH_GROQ_JS }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_GROQ }}*
key: turbo-cache-${{ env.HASH_GROQ }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_NEXT_SANITY }}*
key: turbo-cache-${{ env.HASH_NEXT_SANITY }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_PREVIEW_KIT }}*
key: turbo-cache-${{ env.HASH_PREVIEW_KIT }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_PT_REACT }}*
key: turbo-cache-${{ env.HASH_PT_REACT }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_PT_TO_HTML }}*
key: turbo-cache-${{ env.HASH_PT_TO_HTML }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_PT_TYPES }}*
key: turbo-cache-${{ env.HASH_PT_TYPES }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_TYPES }}*
key: turbo-cache-${{ env.HASH_TYPES }}
- if: always()
uses: actions/cache/save@v4
with:
path: .turbo/cache/${{ env.HASH_ZOD }}*
key: turbo-cache-${{ env.HASH_ZOD }}
- run: npm config set workspaces-update false
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# HACK https://github.com/semantic-release/semantic-release/issues/2313#issuecomment-1004545613
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx multi-semantic-release --ignore-private-packages
lint:
name: Lint
if: github.ref != 'refs/heads/main'
needs: install-node-modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4.1.0
with:
node-version-file: "package.json"
cache: "npm"
- uses: actions/cache/restore@v4
with:
path: |
node_modules
packages/*/node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
fail-on-cache-miss: true
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: npm run lint
- run: |
if [[ $(git status --porcelain) != "" ]]; then
git --no-pager diff --color --text HEAD
exit 1
fi
test-matrix:
name: Test Matrix
if: github.ref != 'refs/heads/main'
needs: install-node-modules
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.set-packages.outputs.packages }}
typescript-versions: ${{ steps.set-typescript-versions.outputs.typescript-versions }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4.1.0
with:
node-version-file: "package.json"
cache: "npm"
- uses: actions/cache/restore@v4
with:
path: |
node_modules
packages/*/node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
fail-on-cache-miss: true
- id: set-packages
run: |
echo "packages=$(npx turbo run build --dry=json | jq --compact-output '.tasks | map(select(.command != "<NONEXISTENT>")) | map(.taskId | sub("@portabletext-typed/"; "pt-") | sub("@sanity-typed/"; "") | sub("#build"; ""))')" >> $GITHUB_OUTPUT
- id: set-typescript-versions
run: |
npx semver --range "$(cat packages/*/package.json | jq --raw-output --slurp '. | map(.peerDependencies.typescript | select( . != null )) | join(" || ")')" $(npm view typescript versions | sed "s/'/\"/g" | jq --raw-output '. | join(" ")') | jq --raw-input --slurp --compact-output '. | rtrimstr("\n") | split("\n") | tostring' | jq --raw-output '. |= "typescript-versions=" + .' >> $GITHUB_OUTPUT
test-package:
name: Test
if: github.ref != 'refs/heads/main'
needs: [install-node-modules, test-matrix]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.test-matrix.outputs.packages) }}
typescript-version: ${{ fromJson(needs.test-matrix.outputs.typescript-versions) }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4.1.0
with:
node-version-file: "package.json"
cache: "npm"
- uses: actions/cache/restore@v4
with:
path: |
node_modules
packages/*/node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
fail-on-cache-miss: true
- if: matrix.typescript-version != 'current'
run: npm install --no-save typescript@${{ matrix.typescript-version }}
- id: cpu-cores
uses: SimenB/github-actions-cpu-cores@v2
- run: npm test -- --max-workers ${{ steps.cpu-cores.outputs.count }} -- ${{ matrix.package }}/src
test:
name: Test
if: always() && github.ref != 'refs/heads/main'
needs: test-package
runs-on: ubuntu-latest
steps:
# https://github.com/github/docs/discussions/30170#discussion-5886646
- if: ${{ needs.test-package.result != 'success' }}
run: |
echo "${{ toJSON(needs.test-package) }}"
exit 1