diff --git a/.github/composite-actions/restore-cache/action.yml b/.github/composite-actions/restore-cache/action.yml new file mode 100644 index 0000000..8c5ae56 --- /dev/null +++ b/.github/composite-actions/restore-cache/action.yml @@ -0,0 +1,40 @@ +name: "Restore Node.js and pnpm caches" +description: "Restore Node.js, pnpm, and cached dependencies without installing" + +inputs: + turbo-cache-key: + description: "Cache key for Turborepo" + required: true + node-modules-cache-key: + description: "Cache key for node_modules" + required: true + +runs: + using: "composite" + steps: + - name: Restore Turborepo cache + uses: actions/cache@v4 + with: + path: .turbo + key: ${{ inputs.turbo-cache-key }} + lookup-only: true + + - name: Restore node_modules cache + uses: actions/cache@v4 + with: + path: | + node_modules + */node_modules + key: ${{ inputs.node-modules-cache-key }} + lookup-only: true + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.11.0 + run_install: false diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index f3e18d2..463f8b5 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -56,8 +56,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node.js and pnpm - uses: ./.github/composite-actions/setup-node-pnpm + - name: Restore Node.js and pnpm caches + uses: ./.github/composite-actions/restore-cache with: turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }} node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} @@ -73,8 +73,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node.js and pnpm - uses: ./.github/composite-actions/setup-node-pnpm + - name: Restore Node.js and pnpm caches + uses: ./.github/composite-actions/restore-cache with: turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }} node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} @@ -90,8 +90,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node.js and pnpm - uses: ./.github/composite-actions/setup-node-pnpm + - name: Restore Node.js and pnpm caches + uses: ./.github/composite-actions/restore-cache with: turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }} node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} @@ -107,8 +107,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node.js and pnpm - uses: ./.github/composite-actions/setup-node-pnpm + - name: Restore Node.js and pnpm caches + uses: ./.github/composite-actions/restore-cache with: turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }} node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} @@ -124,8 +124,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node.js and pnpm - uses: ./.github/composite-actions/setup-node-pnpm + - name: Restore Node.js and pnpm caches + uses: ./.github/composite-actions/restore-cache with: turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }} node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} @@ -143,8 +143,8 @@ jobs: with: fetch-depth: 0 - - name: Setup Node.js and pnpm - uses: ./.github/composite-actions/setup-node-pnpm + - name: Restore Node.js and pnpm caches + uses: ./.github/composite-actions/restore-cache with: turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }} node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}