Skip to content
TypeScript

ci(release): releases no longer reinstall Vite+ in every job (#26305)

Theo Brownea9418a1206f9
diff --git a/.github/actions/setup-ci-deps/action.yml b/.github/actions/setup-ci-deps/action.yml
index e0ef427bd1d..afaef17e1c3 100644
--- a/.github/actions/setup-ci-deps/action.yml
+++ b/.github/actions/setup-ci-deps/action.yml
@@ -5,6 +5,14 @@ inputs:
description: Read-only credential for the private maintainer task cache
required: false
default: ""
+ install:
+ description: Set to "false" to set up Vite+ only, with no pnpm store or install
+ required: false
+ default: "true"
+ install-args:
+ description: Arguments for `vp install`, such as filters. Empty installs the whole workspace.
+ required: false
+ default: ""
runs:
using: composite
steps:
@@ -19,10 +27,11 @@ runs:
echo "node=$(jq -r '.engines.node' package.json)" >> "$GITHUB_OUTPUT"
echo "pnpm=$(jq -r '.packageManager' package.json)" >> "$GITHUB_OUTPUT"
+ # Pinned because release-desktop.yml signs builds with this action in the job.
- name: Cache Vite+
id: vp_cache
if: steps.vp.outputs.version != ''
- uses: actions/cache@v6
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ~/.vite-plus
key: vite-plus-home-v2-${{ runner.os }}-${{ runner.arch }}-${{ steps.vp.outputs.version }}-node${{ steps.vp.outputs.node }}-${{ steps.vp.outputs.pnpm }}
@@ -40,36 +49,66 @@ runs:
- name: Setup Vite+
if: steps.vp_cache.outputs.cache-hit != 'true'
- uses: voidzero-dev/setup-vp@v1
+ uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1
with:
node-version-file: package.json
cache: false
run-install: false
- - name: Resolve pnpm store path
+ # A shared key lets whichever install saves first, often a small filtered
+ # one, become every job's store. Each set of install args gets its own.
+ - name: Resolve pnpm store
id: pnpm_store
+ if: inputs.install == 'true'
shell: bash
+ env:
+ INSTALL_ARGS: ${{ inputs.install-args }}
run: |
- store_path="$(vp pm cache dir)"
- echo "path=$store_path" >> "$GITHUB_OUTPUT"
+ echo "path=$(vp pm cache dir)" >> "$GITHUB_OUTPUT"
+ if [[ -z "$INSTALL_ARGS" ]]; then
+ echo "namespace=full" >> "$GITHUB_OUTPUT"
+ else
+ echo "namespace=filtered-$(printf '%s' "$INSTALL_ARGS" | cksum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
+ fi
- # setup-vp's shared cache key ignores install filters. Keep full installs in a
- # separate namespace, including fallback restores.
+ # Filtered installs prefer the current full store, which holds every package,
+ # over an older store of their own.
# The pnpm store stays a cache tarball on the runner's own disk. A store on a
# Blacksmith sticky disk mounts in under a second, but pnpm then copies every
# package across filesystems instead of hard-linking it: install took 28-49s
# against 9s plus an 11s restore.
- - name: Cache full pnpm store
- uses: actions/cache@v6
+ - name: Restore pnpm store
+ id: pnpm_cache
+ if: inputs.install == 'true'
+ uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.pnpm_store.outputs.path }}
- key: pnpm-full-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', 'package.json') }}
+ key: pnpm-${{ steps.pnpm_store.outputs.namespace }}-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', 'package.json') }}
restore-keys: |
+ pnpm-full-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', 'package.json') }}
+ pnpm-${{ steps.pnpm_store.outputs.namespace }}-v1-${{ runner.os }}-${{ runner.arch }}-
pnpm-full-v1-${{ runner.os }}-${{ runner.arch }}-
- name: Install dependencies
+ if: inputs.install == 'true'
shell: bash
- run: vp install
+ env:
+ INSTALL_ARGS: ${{ inputs.install-args }}
+ # Unquoted so each filter is its own argument.
+ run: vp install $INSTALL_ARGS
+
+ # A filtered install that started from the current full store adds nothing
+ # worth a second copy of it.
+ - name: Save pnpm store
+ if: >-
+ inputs.install == 'true' &&
+ steps.pnpm_cache.outputs.cache-hit != 'true' &&
+ (steps.pnpm_store.outputs.namespace == 'full' ||
+ steps.pnpm_cache.outputs.cache-matched-key != format('pnpm-full-v1-{0}-{1}-{2}', runner.os, runner.arch, hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', 'package.json')))
+ uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
+ with:
+ path: ${{ steps.pnpm_store.outputs.path }}
+ key: ${{ steps.pnpm_cache.outputs.cache-primary-key }}
- name: Enable shared task cache
if: >-
diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml
index bff1b125be4..ca418467f6b 100644
--- a/.github/workflows/release-desktop.yml
+++ b/.github/workflows/release-desktop.yml
@@ -147,13 +147,6 @@ jobs:
git sparse-checkout set --no-cone '/*' '!/.repos/'
git -c checkout.workers=0 checkout --detach FETCH_HEAD
- - name: Setup Vite+
- uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1
- with:
- node-version-file: package.json
- cache: true
- run-install: false
-
# pnpm checks the lockfile and policy before reusing this result. A missing
# artifact leaves the cache empty, so installation runs the checks again.
- name: Download dependency verification
@@ -163,10 +156,12 @@ jobs:
name: release-dependency-verification
path: ${{ runner.temp }}/pnpm-metadata
- - name: Install desktop dependencies
+ - name: Setup dependencies
+ uses: ./.github/actions/setup-ci-deps
+ with:
+ install-args: --filter=@t3tools/desktop... --filter=t3... --filter=@t3tools/scripts...
env:
pnpm_config_cache_dir: ${{ runner.temp }}/pnpm-metadata
- run: vp install --filter=@t3tools/desktop... --filter=t3... --filter=@t3tools/scripts...
- name: Cache resource monitor
id: resource_monitor_cache
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 33076d208f3..e8f300242f0 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -420,14 +420,10 @@ jobs:
!/.repos/
sparse-checkout-cone-mode: false
- - name: Setup Vite+
- uses: voidzero-dev/setup-vp@v1
+ - name: Setup dependencies
+ uses: ./.github/actions/setup-ci-deps
with:
- node-version-file: package.json
- cache: true
- run-install: |
- args:
- - --filter=t3code-relay...
+ install-args: --filter=t3code-relay...
# The deployed stack's outputs, read from Alchemy's state store without
# planning or applying. Select the backend explicitly to avoid loading
@@ -522,13 +518,6 @@ jobs:
!/.repos/
sparse-checkout-cone-mode: false
- - name: Setup Vite+
- uses: voidzero-dev/setup-vp@v1
- with:
- node-version-file: package.json
- cache: true
- run-install: false
-
# pnpm checks the lockfile and policy before reusing this result. A missing
# artifact leaves the cache empty, so installation runs the checks again.
- name: Download dependency verification
@@ -538,10 +527,12 @@ jobs:
name: release-dependency-verification
path: ${{ runner.temp }}/pnpm-metadata
- - name: Install bundle dependencies
+ - name: Setup dependencies
+ uses: ./.github/actions/setup-ci-deps
+ with:
+ install-args: --filter=t3... --filter=@t3tools/web... --filter=@t3tools/desktop... --filter=@t3tools/scripts...
env:
pnpm_config_cache_dir: ${{ runner.temp }}/pnpm-metadata
- run: vp install --filter=t3... --filter=@t3tools/web... --filter=@t3tools/desktop... --filter=@t3tools/scripts...
- name: Download relay client tracing config
uses: actions/download-artifact@v8
@@ -781,14 +772,10 @@ jobs:
!/.repos/
sparse-checkout-cone-mode: false
- - name: Setup Vite+
- uses: voidzero-dev/setup-vp@v1
+ - name: Setup dependencies
+ uses: ./.github/actions/setup-ci-deps
with:
- node-version-file: package.json
- cache: true
- run-install: |
- args:
- - --filter=@t3tools/scripts...
+ install-args: --filter=@t3tools/scripts...
- name: Download all desktop artifacts
uses: actions/download-artifact@v8
@@ -977,15 +964,10 @@ jobs:
!/.repos/
sparse-checkout-cone-mode: false
- - name: Setup Vite+
- uses: voidzero-dev/setup-vp@v1
+ - name: Setup dependencies
+ uses: ./.github/actions/setup-ci-deps
with:
- node-version-file: package.json
- cache: true
- run-install: |
- args:
- - --filter=t3...
- - --filter=@t3tools/scripts...
+ install-args: --filter=t3... --filter=@t3tools/scripts...
- name: Build the npm launcher
run: node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
@@ -1041,15 +1023,10 @@ jobs:
!/.repos/
sparse-checkout-cone-mode: false
- - name: Setup Vite+
- uses: voidzero-dev/setup-vp@v1
+ - name: Setup dependencies
+ uses: ./.github/actions/setup-ci-deps
with:
- node-version-file: package.json
- cache: true
- run-install: |
- args:
- - --filter=@t3tools/scripts...
- - --filter=@t3tools/web...
+ install-args: --filter=@t3tools/scripts... --filter=@t3tools/web...
- name: Download relay client tracing config
uses: actions/download-artifact@v8
@@ -1145,11 +1122,9 @@ jobs:
sparse-checkout-cone-mode: false
- name: Setup Vite+
- uses: voidzero-dev/setup-vp@v1
+ uses: ./.github/actions/setup-ci-deps
with:
- node-version-file: package.json
- cache: false
- run-install: false
+ install: false
- name: Alias channel
shell: bash
@@ -1216,14 +1191,10 @@ jobs:
!/.repos/
sparse-checkout-cone-mode: false
- - name: Setup Vite+
- uses: voidzero-dev/setup-vp@v1
+ - name: Setup dependencies
+ uses: ./.github/actions/setup-ci-deps
with:
- node-version-file: package.json
- cache: true
- run-install: |
- args:
- - --filter=@t3tools/marketing...
+ install-args: --filter=@t3tools/marketing...
- id: deploy
name: Build staged deployment
@@ -1287,11 +1258,9 @@ jobs:
sparse-checkout-cone-mode: false
- name: Setup Vite+
- uses: voidzero-dev/setup-vp@v1
+ uses: ./.github/actions/setup-ci-deps
with:
- node-version-file: package.json
- cache: false
- run-install: false
+ install: false
- name: Promote marketing site
shell: bash
@@ -1346,15 +1315,10 @@ jobs:
echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
- - name: Setup Vite+
- uses: voidzero-dev/setup-vp@v1
+ - name: Setup dependencies
+ uses: ./.github/actions/setup-ci-deps
with:
- node-version-file: package.json
- cache: true
- run-install: |
- args:
- - --filter=@t3tools/scripts...
- - --filter=@t3tools/oxlint-plugin-t3code...
+ install-args: --filter=@t3tools/scripts... --filter=@t3tools/oxlint-plugin-t3code...
- id: update_versions
name: Update version strings
@@ -1411,14 +1375,10 @@ jobs:
!/.repos/
sparse-checkout-cone-mode: false
- - name: Setup Vite+
- uses: voidzero-dev/setup-vp@v1
+ - name: Setup dependencies
+ uses: ./.github/actions/setup-ci-deps
with:
- node-version-file: package.json
- cache: true
- run-install: |
- args:
- - --filter=@t3tools/scripts...
+ install-args: --filter=@t3tools/scripts...
- name: Read published release notes
if: needs.preflight.outputs.is_prerelease == 'true'