hmu332233 / tips

https://tips.minung.dev
1 stars 0 forks source link

github action #33

Open hmu332233 opened 2 years ago

hmu332233 commented 2 years ago

Search Keyword action, 깃헙액션, 액션

hmu332233 commented 2 years ago

다른 디렉토리에서 동작하기

working-directory 이용

- name: Install
  run: yarn install
  working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Run
  run: yarn start
  env:
    DB_URL: ${{ secrets.DB_URL }}
  working-directory: ${{ env.WORKING_DIRECTORY }}

내 레포에서 사용 예시

캐싱

actions/cache@v2 이용 id 값을 통해서 output 값에 접근도 가능함, 예시에서는 steps.cache.outputs.cache-hit 값으로 캐싱된게 있는지 체크 가능

- name: Cache node modules
  uses: actions/cache@v2
  id: cache # 해당 step을 대표하는 id
  with:
    path: ${{ env.WORKING_DIRECTORY }}/node_modules # 캐싱할 대상
    key: ${{ runner.os }}-yarn-parse-${{ hashFiles('**/yarn.lock') }} # 캐싱 여부를 판단할 key
    restore-keys: |
      ${{ runner.os }}-yarn-parse-

내 레포에서 사용 예시

GITHUB TOKEN

image

내 레포에서 사용 예시