Skip to content

Commit

Permalink
storing in output variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagarjun Sanji committed Jul 1, 2024
1 parent 45dfaa5 commit 81e9fd7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
setup:
runs-on: ubuntu-latest
outputs:
package-lock-hash: ${{ steps.hash.outputs.hash }}
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
Expand All @@ -17,24 +19,23 @@ jobs:
node-version: '22'
- name: Install dependencies
run: npm ci
- name: Calculate package-lock.json hash
id: hash
run: echo "::set-output name=hash::$(sha256sum package-lock.json | awk '{ print $1 }')"
- name: Cache repository
uses: actions/cache@v4
with:
path: .
key: ${{ runner.os }}-repo-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-repo-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-repo-${{ steps.hash.outputs.hash }}
build:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Restore repository cache
uses: actions/cache@v4
with:
path: .
key: ${{ runner.os }}-repo-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-repo-${{ needs.setup.outputs.package-lock-hash }}
fail-on-cache-miss: true
- name: Compile
run: npm run compile
Expand All @@ -47,7 +48,7 @@ jobs:
uses: actions/cache@v4
with:
path: .
key: ${{ runner.os }}-repo-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-repo-${{ needs.setup.outputs.package-lock-hash }}
fail-on-cache-miss: true
- name: Install system dependencies
run: |
Expand Down

0 comments on commit 81e9fd7

Please sign in to comment.