Skip to content

Commit

Permalink
Merge branch 'main' into feature/29-manage-jwt
Browse files Browse the repository at this point in the history
  • Loading branch information
m-a-king authored Nov 24, 2024
2 parents 9b37dd4 + 37b08bb commit 884c477
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 12 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
push:
branches: [ main ]

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Github Repository 파일 불러오기
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: JDK 21 버전 설치
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Gradle 캐싱
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: 빌드 권한 부여
run: chmod +x ./gradlew
shell: bash

- name: 빌드 및 테스트
run: ./gradlew build

- name: 도커 허브 로그인
run: echo "${{ secrets.DOCKER_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: 도커 이미지 빌드및 Push
run: |
docker build -t 7zrv/somemore:${GITHUB_SHA::7} -t 7zrv/somemore:latest .
docker push 7zrv/somemore:${GITHUB_SHA::7}
docker push 7zrv/somemore:latest
14 changes: 2 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
java-version: 21

- name: Gradle 캐싱
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand All @@ -73,7 +73,7 @@ jobs:
- name: Close PR, if build fail
if: ${{ failure() }}
uses: actions/github-script@v6
with: # actions(uses)의 파라미터 역할
with:
github-token: ${{ github.TOKEN }}
script: |
const pull_number = ${{ github.event.pull_request.number }}
Expand All @@ -93,16 +93,6 @@ jobs:
state: 'closed'
})
- name: 도커 허브 로그인
run:
echo "${{ secrets.DOCKER_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: 도커 빌드및 Push
run: |
docker build -t 7zrv/somemore:${GITHUB_SHA::7} -t 7zrv/somemore:latest .
docker push 7zrv/somemore:${GITHUB_SHA::7}
docker push 7zrv/somemore:latest
- name: SonarCloud 빌드및 분석
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down

0 comments on commit 884c477

Please sign in to comment.