Skip to content

Commit 59fc792

Browse files
committed
fix: use resolved node verion in cache keys
Signed-off-by: Reinis Martinsons <[email protected]>
1 parent 66e3f2b commit 59fc792

File tree

6 files changed

+51
-9
lines changed

6 files changed

+51
-9
lines changed

.github/actions/cache-evm-artifacts/action.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@ outputs:
1414
runs:
1515
using: "composite"
1616
steps:
17+
- name: Resolve Node version
18+
id: resolved-node
19+
uses: ./.github/actions/setup-node-if-needed
20+
with:
21+
node_version: ${{ inputs.node_version }}
1722
- name: Cache EVM artifacts
1823
id: evm-artifacts-cache
1924
uses: actions/cache@v4
2025
with:
2126
path: ${{ inputs.path }}
22-
key: evm-artifacts-${{ runner.os }}-node-${{ inputs.node_version }}-${{ hashFiles('yarn.lock', 'hardhat.config.ts', 'contracts/**/*.sol') }}
27+
key: evm-artifacts-${{ runner.os }}-node-${{ steps.resolved-node.outputs.version }}-${{ hashFiles('yarn.lock', 'hardhat.config.ts', 'contracts/**/*.sol') }}

.github/actions/cache-svm-artifacts/action.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ outputs:
1717
runs:
1818
using: "composite"
1919
steps:
20+
- name: Resolve Node version
21+
id: resolved-node
22+
uses: ./.github/actions/setup-node-if-needed
23+
with:
24+
node_version: ${{ inputs.node_version }}
2025
- name: Cache SVM artifacts
2126
id: svm-artifacts-cache
2227
uses: actions/cache@v4
2328
with:
2429
path: ${{ inputs.path }}
25-
key: svm-${{ inputs.type }}-${{ runner.os }}-node-${{ inputs.node_version }}-${{ hashFiles('Cargo.lock', 'programs/**/Cargo.toml', 'programs/**/Xargo.toml', 'programs/**/*.rs') }}
30+
key: svm-${{ inputs.type }}-${{ runner.os }}-node-${{ steps.resolved-node.outputs.version }}-${{ hashFiles('Cargo.lock', 'programs/**/Cargo.toml', 'programs/**/Xargo.toml', 'programs/**/*.rs') }}

.github/actions/generate-evm-artifacts/action.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ runs:
77
using: "composite"
88
steps:
99
- name: "Use Node ${{ inputs.node_version }}"
10-
uses: actions/setup-node@v3
10+
uses: ./.github/actions/setup-node-if-needed
1111
with:
12-
node-version: "${{ inputs.node_version }}"
13-
cache: yarn
12+
node_version: ${{ inputs.node_version }}
1413
- name: Install packages
1514
shell: bash
1615
run: yarn install --frozen-lockfile

.github/actions/generate-svm-artifacts/action.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ runs:
77
using: "composite"
88
steps:
99
- name: "Use Node ${{ inputs.node_version }}"
10-
uses: actions/setup-node@v3
10+
uses: ./.github/actions/setup-node-if-needed
1111
with:
12-
node-version: "${{ inputs.node_version }}"
13-
cache: yarn
12+
node_version: ${{ inputs.node_version }}
1413
- name: Setup Anchor & Solana
1514
uses: ./.github/actions/setup-solana-anchor
1615
with:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Setup Node if needed
2+
description: "Set up Node.js if it is not already installed and resolve the version."
3+
inputs:
4+
node_version:
5+
description: "Node version to use"
6+
required: true
7+
outputs:
8+
version:
9+
description: "Resolved Node.js version"
10+
value: ${{ steps.resolved-node.outputs.version }}
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Check if Node is installed
15+
id: check-node
16+
shell: bash
17+
run: |
18+
if command -v node >/dev/null 2>&1; then
19+
echo "installed=true" >> "$GITHUB_OUTPUT"
20+
else
21+
echo "installed=false" >> "$GITHUB_OUTPUT"
22+
fi
23+
- name: Setup Node.js
24+
if: steps.check-node.outputs.installed == 'false'
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: "${{ inputs.node_version }}"
28+
- name: Resolve actual Node version
29+
id: resolved-node
30+
shell: bash
31+
run: echo "version=$(node -v | sed 's/^v//')" >> "$GITHUB_OUTPUT"

.github/actions/setup-solana-anchor/action.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ inputs:
1010
runs:
1111
using: "composite"
1212
steps:
13+
- name: "Use Node ${{ inputs.node_version }}"
14+
uses: ./.github/actions/setup-node-if-needed
15+
with:
16+
node_version: ${{ inputs.node_version }}
1317
- name: Extract Solana versions
1418
uses: solana-developers/github-actions/[email protected]
1519
id: versions
@@ -19,4 +23,3 @@ runs:
1923
anchor_version: ${{ steps.versions.outputs.anchor_version }}
2024
solana_version: ${{ steps.versions.outputs.solana_version }}
2125
verify_version: ${{ inputs.verify_version }}
22-
node_version: ${{ inputs.node_version }}

0 commit comments

Comments
 (0)