새소식

반응형
Git/GitHub

Github Action 에서 현재 시간 가져오기 $(date) "$GITHUB_OUTPUT"

  • -
반응형

2024-02-09


사진: Unsplash 의 Scott Lord


1. 방법

 

      - name: Get current date
        id: date
        run: echo "date=$(date +'%Y-%m-%d-%H-%M-%S')" >> "$GITHUB_OUTPUT"
      - run: echo ${{ steps.date.outputs.date }}

2. 예시

 

도커 이미지에 날짜 태그로 붙여서 사용

 

docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.MAIN_DOCKER_REPONAME }}:${{ steps.date.outputs.date }}

3. 출처

 

https://stackoverflow.com/questions/60942067/get-current-date-and-time-in-github-workflows

 

Get current date and time in GitHub workflows

I have a GitHub workflow for releasing nightly snapshots of the repository. It uses the create-release action. This is how the workflow file looks right now: name: Release Nightly Snapshot on:

stackoverflow.com

https://hynek.me/til/set-output-deprecation-github-actions/

 

How to Fix the set-output GitHub Actions Deprecation Warning

If you have a GitHub Actions workflow that sets an output using echo ::set-output key=value, you have started to see an unhelpful deprecation warning. Here’s how to fix it.

hynek.me


메인 이미지 출처 : 사진: UnsplashScott Lord

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.