ci: skip node setup when already present
This commit is contained in:
@@ -18,7 +18,27 @@ jobs:
|
||||
with:
|
||||
github-server-url: https://git.dumas.ddns.net
|
||||
|
||||
- name: Check existing Node.js
|
||||
id: node-check
|
||||
shell: bash
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
|
||||
if command -v node >/dev/null 2>&1; then
|
||||
node_version="$(node -p 'process.versions.node')"
|
||||
node_major="${node_version%%.*}"
|
||||
|
||||
if [ "$node_major" = "20" ]; then
|
||||
echo "use_existing_node=true" >> "$GITHUB_OUTPUT"
|
||||
echo "Node.js $node_version already available; skipping setup-node"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "use_existing_node=false" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.node-check.outputs.use_existing_node != 'true'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
@@ -32,4 +52,3 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
|
||||
Reference in New Issue
Block a user