ci: pin next and zod so npm and pnpm resolve the same versions #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update example OpenUI packages | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - ci/dispatch-template-parity | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: fix-template-package-manager-parity | |
| cancel-in-progress: false | |
| jobs: | |
| fix: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.repository.default_branch }} | |
| - uses: pnpm/action-setup@v6 | |
| with: | |
| version: 10.33.0 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| - name: Refresh template npm lockfiles | |
| run: | | |
| set -euo pipefail | |
| ( | |
| cd templates/openui-cloud | |
| rm -rf node_modules package-lock.json | |
| npm install --no-audit --no-fund --progress=false --save-exact next@16.3.4 zod@4.5.4 | |
| rm -rf node_modules | |
| ) | |
| ( | |
| cd templates/openui-self-hosted | |
| rm -rf node_modules package-lock.json | |
| npm install --no-audit --no-fund --progress=false --save-exact next@16.3.4 | |
| rm -rf node_modules | |
| ) | |
| - name: Verify npm/pnpm parity | |
| run: | | |
| set -euo pipefail | |
| for template in openui-cloud openui-self-hosted; do | |
| npm_dir="${RUNNER_TEMP}/${template}-npm" | |
| pnpm_dir="${RUNNER_TEMP}/${template}-pnpm" | |
| rm -rf "$npm_dir" "$pnpm_dir" | |
| cp -R "templates/${template}" "$npm_dir" | |
| cp -R "templates/${template}" "$pnpm_dir" | |
| rm -f "${pnpm_dir}/package-lock.json" | |
| (cd "$npm_dir" && npm ci --prefer-offline --no-audit --no-fund --progress=false) | |
| (cd "$pnpm_dir" && pnpm install) | |
| node packages/openui-cli/scripts/compare-template-installs.mjs "$npm_dir" "$pnpm_dir" | |
| done | |
| - name: Create or update pull request | |
| env: | |
| BASE_BRANCH: ${{ github.event.repository.default_branch }} | |
| GH_TOKEN: ${{ github.token }} | |
| UPDATE_BRANCH: automation/template-package-manager-parity | |
| run: | | |
| set -euo pipefail | |
| paths=( | |
| templates/openui-cloud/package-lock.json | |
| templates/openui-self-hosted/package-lock.json | |
| templates/openui-cloud/package.json | |
| templates/openui-self-hosted/package.json | |
| ) | |
| if git diff --quiet -- "${paths[@]}"; then | |
| echo "Template lockfiles already match pnpm." | |
| exit 0 | |
| fi | |
| remote_sha="$(git ls-remote --heads origin "refs/heads/$UPDATE_BRANCH" | awk '{print $1}')" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git switch -C "$UPDATE_BRANCH" | |
| git add "${paths[@]}" | |
| git commit -m "fix: refresh CLI template lockfiles for npm/pnpm parity" | |
| if [[ -n "$remote_sha" ]]; then | |
| git push --force-with-lease="refs/heads/$UPDATE_BRANCH:$remote_sha" origin "HEAD:refs/heads/$UPDATE_BRANCH" | |
| else | |
| git push origin "HEAD:refs/heads/$UPDATE_BRANCH" | |
| fi | |
| existing_pr="$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$UPDATE_BRANCH" --state open --json number --jq '.[0].number')" | |
| if [[ -n "$existing_pr" ]]; then | |
| gh pr view "$existing_pr" --repo "$GITHUB_REPOSITORY" --json url --jq .url | |
| exit 0 | |
| fi | |
| pr_body="Refresh the openui-cloud and openui-self-hosted npm lockfiles so npm ci and a fresh pnpm install resolve the same direct dependency versions. Unblocks CLI Template Package Manager Parity on main (next 16.3.4; cloud zod 4.5.4)." | |
| gh pr create \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --base "$BASE_BRANCH" \ | |
| --head "$UPDATE_BRANCH" \ | |
| --title "fix: refresh CLI template lockfiles for npm/pnpm parity" \ | |
| --body "$pr_body" |