-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat: CI 파일 추가 * Feat: CD 파일 추가 * Fix: buildBootImage에 생성 일자 추가
- Loading branch information
1 parent
e5aa835
commit 41dbf8f
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
cd: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
IMAGE_TAG: ${{ github.sha }} | ||
REPO: ${{ secrets.DOCKER_REPOSITORY }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: 'gradle' | ||
|
||
- name: Set up Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
|
||
- name: Execute Gradle build | ||
run: ./gradlew clean :bootBuildImage --imageName=$REPO:$IMAGE_TAG | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Publish Docker image | ||
run: | | ||
echo "Pushing Docker image with tag: $IMAGE_TAG" | ||
docker push $REPO:$IMAGE_TAG | ||
- name: Send command by AWS SSM | ||
uses: peterkimzz/aws-ssm-send-command@master | ||
id: ssm | ||
with: | ||
aws-region: ap-northeast-2 | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
instance-ids: ${{ secrets.AWS_INSTANCE_ID }} | ||
working-directory: ${{ vars.DEPLOY_SCRIPT_PATH }} | ||
command: | | ||
echo "############# PULL DOCKER IMAGE #############" | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | ||
docker pull ${{ env.REPO }}:${{ env.IMAGE_TAG }} | ||
echo "############# RUN DEPLOY SCRIPT #############" | ||
sh deploy.sh ${{ env.REPO }} ${{ env.IMAGE_TAG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: 'gradle' | ||
|
||
- name: Set up Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
|
||
- name: Test with Gradle | ||
run: ./gradlew clean test --stacktrace --parallel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,7 @@ dependencies { | |
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} | ||
|
||
tasks.bootBuildImage { | ||
createdDate = "now" | ||
} |