Spring/[P] AI 챗봇 기반 맞춤형 레시피 서비스

[AWS ElasticBeanstalk/GitHub Action] CI/CD 구축 (2) GitHub Action Secrets 등록하기

alsruds 2024. 3. 13. 23:20

 

 

GitHub Action 에서 사용할 Secret 환경 변수를 등록해 봅시다 ~

 


 

[ GitHub Action 에서 Secrets 사용하기  ]

 

0. 공식 문서 확인하기

🏠 https://docs.github.com/ko/actions/security-guides/using-secrets-in-github-actions?tool=webui

 

GitHub Actions에서 비밀 사용 - GitHub Docs

Secrets are variables that you create in an organization, repository, or repository environment. The secrets that you create are available to use in GitHub Actions workflows. GitHub Actions can only read a secret if you explicitly include the secret in a w

docs.github.com

 

(+) https://octopus.com/blog/githubactions-secrets

 

Secrets in GitHub Actions - Octopus Deploy

As part of our series about Continuous Integration and build servers, learn how to add secrets in GitHub to use with GitHub Actions, plus how to call them in workflows.

octopus.com

 

1. AWS IAM 사용자 생성

IAM 사용자 생성 → 액세스 키 발급받아서 GitHub Action Secrets 에 등록하기

 

· S3 권한을 추가해주어야 후에 AWS EB 를 통해 생성되는 S3 관리를 할 수 있다 (ex. 권한 없을 시 삭제 불가)

 

2. Secrets and variables 에 원하는 이름으로 환경 변수 생성

경로
등록 페이지

 

· 리포지토리 Settings > Secrets and variables > Actions > Repository secrets > New repository secret

          - Name : 원하는 이름

          - Secret : 내용

· 등록할 액세스 키

          - AWS_ACTION_ACCESS_KEY_ID : IAM 사용자 생성 후 발급받은 access key

          - AWS_ACTION_SECRET_ACCESS_KEY : IAM 사용자 생성 후 발급받은 secret access key

          - APPLICATION_DEV :  springboot 환경 설정 파일 (ex. application.yml)

 

3. GitHub Action 배포 스크립트에서 적용하기

✔️ 적용 예시 : ${{ secrets.위에서_설정했던_변수_이름 }}

2024.03.12 - [Spring/[Project] AI 챗봇 기반 맞춤형 레시피 서비스] - [AWS ElasticBeanstalk/GitHub Action] CI/CD 구축 (1) 배포 스크립트 작성하기

 

[AWS ElasticBeanstalk/GitHub Action] CI/CD 구축 (1) 배포 스크립트 작성하기

GitHub Action 은 대상 리포지토리 .github 내 yml 파일을 읽어 동작을 수행합니다 배포를 진행하기 위한 스크립트를 작성해봅시당 :-) ⭐ 리포지토리 파일의 Root 경로에 .github 파일 위치시키기 !! [ 개발

alsrudalsrudalsrud.tistory.com