88 description : ' Print the output after the build'
99 required : false
1010 default : ' false'
11+ skip-native :
12+ description : >-
13+ Skip the NAPI binding cache and all native cargo/napi build steps; the
14+ native binaries must already be in place (e.g. downloaded from the
15+ windows-cli-binaries artifact produced by the build-windows-cli job).
16+ required : false
17+ default : ' false'
1118
1219runs :
1320 using : ' composite'
3845 # Cache NAPI bindings and Rust CLI binary (the slow parts, especially on Windows)
3946 - name : Restore NAPI binding cache
4047 id : cache-restore
48+ if : inputs.skip-native != 'true'
4149 uses : actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
4250 with :
4351 path : |
@@ -69,14 +77,14 @@ runs:
6977
7078 # Install zig + cargo-zigbuild for musl cross-compilation (napi-cross only supports gnu)
7179 - name : Add musl Rust target
72- if : steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
80+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
7381 shell : bash
7482 run : rustup target add ${INPUTS_TARGET}
7583 env :
7684 INPUTS_TARGET : ${{ inputs.target }}
7785
7886 - name : Setup zig (musl)
79- if : steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
87+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
8088 uses : mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
8189 with :
8290 version : 0.15.2
@@ -87,15 +95,15 @@ runs:
8795 # the pinned git commit. TODO: revert to taiki-e/install-action once
8896 # cargo-zigbuild > 0.22.3 is released.
8997 - name : Install cargo-zigbuild (musl)
90- if : steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
98+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
9199 shell : bash
92100 run : cargo install --locked --git https://github.com/rust-cross/cargo-zigbuild --rev 7e791b4be71b9870e0abccedf7885486803cd923 cargo-zigbuild
93101
94102 # NAPI builds - only run on cache miss (slow, especially on Windows)
95103 # Must run before vite-plus TypeScript builds which depend on the bindings
96104 - name : Build NAPI bindings (Linux gnu)
97105 shell : bash
98- if : steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'linux') && !contains(inputs.target, 'musl')
106+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'linux') && !contains(inputs.target, 'musl')
99107 run : |
100108 pnpm --filter=vite-plus build-native --target ${INPUTS_TARGET} --use-napi-cross
101109 env :
@@ -106,7 +114,7 @@ runs:
106114
107115 - name : Build NAPI bindings (Linux musl)
108116 shell : bash
109- if : steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
117+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
110118 run : |
111119 pnpm --filter=vite-plus build-native --target ${INPUTS_TARGET} -x
112120 env :
@@ -117,15 +125,15 @@ runs:
117125
118126 - name : Build NAPI bindings (non-Linux targets)
119127 shell : bash
120- if : steps.cache-restore.outputs.cache-hit != 'true' && !contains(inputs.target, 'linux')
128+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true' && !contains(inputs.target, 'linux')
121129 run : |
122130 pnpm --filter=vite-plus build-native --target ${INPUTS_TARGET}
123131 env :
124132 DEBUG : napi:*
125133 INPUTS_TARGET : ${{ inputs.target }}
126134
127135 - name : Build Rust CLI binary (Linux gnu)
128- if : steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'linux') && !contains(inputs.target, 'musl')
136+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'linux') && !contains(inputs.target, 'musl')
129137 shell : bash
130138 run : |
131139 pnpm exec napi build --use-napi-cross --target ${INPUTS_TARGET} --release -p vite_global_cli
@@ -136,7 +144,7 @@ runs:
136144 INPUTS_TARGET : ${{ inputs.target }}
137145
138146 - name : Build Rust CLI binary (Linux musl)
139- if : steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
147+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
140148 shell : bash
141149 run : |
142150 pnpm exec napi build -x --target ${INPUTS_TARGET} --release -p vite_global_cli
@@ -147,28 +155,28 @@ runs:
147155 INPUTS_TARGET : ${{ inputs.target }}
148156
149157 - name : Build Rust CLI binary (non-Linux targets)
150- if : steps.cache-restore.outputs.cache-hit != 'true' && !contains(inputs.target, 'linux')
158+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true' && !contains(inputs.target, 'linux')
151159 shell : bash
152160 run : cargo build --release --target ${INPUTS_TARGET} -p vite_global_cli
153161 env :
154162 INPUTS_TARGET : ${{ inputs.target }}
155163
156164 - name : Build trampoline shim binary (Windows only)
157- if : steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'windows')
165+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'windows')
158166 shell : bash
159167 run : cargo build --release --target ${INPUTS_TARGET} -p vite_trampoline
160168 env :
161169 INPUTS_TARGET : ${{ inputs.target }}
162170
163171 - name : Build installer binary (Windows only)
164- if : steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'windows')
172+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'windows')
165173 shell : bash
166174 run : cargo build --release --target ${INPUTS_TARGET} -p vite_installer
167175 env :
168176 INPUTS_TARGET : ${{ inputs.target }}
169177
170178 - name : Save NAPI binding cache
171- if : steps.cache-restore.outputs.cache-hit != 'true'
179+ if : inputs.skip-native != 'true' && steps.cache-restore.outputs.cache-hit != 'true'
172180 uses : actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
173181 with :
174182 path : |
0 commit comments