코딩과로그
[GItHub Actions] Artifact 얻기 본문
github Actions 내에서 작업했던 파일들을 다운받고 싶을 때에 workflow에 아래의 코드를 추가하면 결과물을 얻어올 수 있다.
workflow 작성한 링크
- uses: actions/upload-artifact@v3
with:
name: my-artifact
# 저장하고 싶은 파일(or 폴더)의 위치
path: path/to/artifact/world.txt
사용 예제 workflows:
name: get-artifact
run-name: get-artifact 🚀
# Event
on: [workflow_dispatch]
jobs:
upload-artifact:
runs-on: ubuntu-latest
steps:
- name: Build project
run: echo "HELLOW" > buildFile.txt
- uses: actions/upload-artifact@v3
with:
name: my-artifact
path: . # or path/to/artifact
결과물 얻기
얻은 결과물을 다음 workFlow에서 사용하기
얻은 결과물을 다음 workflow에서 사용할 수 있다.
name: get-artifact
run-name: get-artifact 🚀
# Event
on: [workflow_dispatch]
jobs:
upload-artifact:
runs-on: ubuntu-latest
steps:
- name: Build project
run: echo "HELLOW" > buildFile.txt
- uses: actions/upload-artifact@v3
with:
name: my-artifact
path: . # or path/to/artifact
download-artifact:
needs: upload-artifact
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: my-artifact
- run : ls -al
업로드했던 파일을 workflow 상에서 다운받은 결과 (ls -al)
결과물 링크
'기타1 > 깃헙 액션' 카테고리의 다른 글
[TIL] 깃허브 캐시값 얻어오기 링크 (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 |