//cmd
git --version
ssh-keygen -t rsa -C "[깃허브 이메일]"
해당 파일을 깃허브에 등록해야함(id_rsa.pub 메모장으로 열고 전부 복사!)
New SSH Key 파란색
클릭
Add SSH Key
클릭
최상단에서 .github 폴더 생성
ci.yml
들어갈 내용
# 1. workflows 이름 지정
name: CI
# 2. workflows 시작 조건
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest # 3. 실행 환경
# 4. 실행 순서
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean build
깃 푸시 하기
(만약 되지 않는다??)
// .gitgnore 수정!!!!!!!!!!!!!!!!!!!!!!!!!
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
.DS_Store
.
.
.
jar {
enabled = false
}
cicd.yml로 바꾸고 추가하기
# 1. workflows 이름 지정
name: CI/CD
# 2. workflows 시작 조건 지정
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest # 3. 실행 환경 지정
# 4. 실행 순서 지정
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'corretto' // 이부분 바뀜!!!!!!!!!!!!!!!!!!
java-version: '17'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean build
# 5. 현재 시간 가져오기
- name: Get current time
uses: josStorer/get-current-time@v2.0.2
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00"
# 6. 배포용 패키지 경로 저장
- name: Set artifact
run: echo "artifact=$(ls ./build/libs)" >> $GITHUB_ENV
# 7. EB 배포
- name: Beanstalk Deploy
uses: einaregilsson/beanstalk-deploy@v20
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: springboot-developer
environment_name: springboot-developer-env
version_label: github-action-${{steps.current-time.outputs.formattedTime}}
region: ap-northeast-2
deployment_package: ./build/libs/${{env.artifact}}
생성 -> github-action -> 보안자격증명 -> 엑세스 키 만들기
.csv 다운로드 클릭 -> 메모장에 기록
new repository secret 클릭
application.yml에서 clientid, client secret, jwt 전부 삭제
spring:
jpa:
show-sql: true
properties:
hibernate:
format_sql: true
defer-datasource-initialization: true
h2:
console:
enabled: true
security:
oauth2:
client:
registration:
google:
client-id: client-id
client-secret: client-secret
scope:
- email
- profile
jwt:
issuer: ajufresh@gmail.com
secret_key: secret-key
깃 푸시!!
이상없음!!