코딩과로그
[TIL] 깃허브 캐시값 얻어오기 링크 본문
WorkFlows 진행 시 빈번히 설치하는 의존 Library들이 있는데 매번 workflows를 실행할 때마다 Library를 설치하면 시간소요가 많이 된다.
github에서 지원하는 Cache를 사용하면 의존 library를 한번 설치한 다음부터는 Workflows에는 설치했던 라이브버리를 이전보다 빠르게 가져올 수 있도록 할 수 있다.
예제:
workflows
name: cacheing-dependency
run-name: cacheing-dependency 🚀
# Event
on: [workflow_dispatch]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v3
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: |
cd react-sample
npm ci
reference:
github 공식 문서
'기타1 > 깃헙 액션' 카테고리의 다른 글
[GItHub Actions] Artifact 얻기 (0) | 2023.05.01 |
---|---|
[TIL] Github actions 내 Context 출력하기 (0) | 2023.05.01 |
[기록용] gh-action Artifact vs outputs, cache 무슨 차이가 있나? (0) | 2023.04.09 |
[기록용] GitHub Action 기본 구성 요소 (WorkFlow, Jobs, Steps) (0) | 2023.04.09 |