ci: skip node setup when already present
This commit is contained in:
@@ -41,7 +41,27 @@ jobs:
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
- 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
|
- name: Setup Node.js
|
||||||
|
if: steps.node-check.outputs.use_existing_node != 'true'
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
@@ -72,4 +92,3 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Playwright suite
|
- name: Run Playwright suite
|
||||||
run: npm run test:e2e
|
run: npm run test:e2e
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,27 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
github-server-url: https://git.dumas.ddns.net
|
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
|
- name: Setup Node.js
|
||||||
|
if: steps.node-check.outputs.use_existing_node != 'true'
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
@@ -32,4 +52,3 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user