-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #209 from TrandPick/development
트랜드픽 ver 1.0.0 배포
- Loading branch information
Showing
180 changed files
with
9,705 additions
and
45 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,104 @@ | ||
name: 'work-1' | ||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/**' | ||
- 'src/**' | ||
- 'build.gradle' | ||
- 'Dockerfile' | ||
- 'readme.md' | ||
branches: | ||
- 'main' | ||
jobs: | ||
build: | ||
name: 빌드 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: application-secret.yml 생성 | ||
env: | ||
ACTIONS_STEP_DEBUG: true | ||
APPLICATION_SECRET: ${{ secrets.APPLICATION_SECRET_YML }} | ||
run: echo "$APPLICATION_SECRET" > src/main/resources/application-secret.yml | ||
- name: jdk 17 설치 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: 'gradle' | ||
- name: gradlew 실행 권한 부여 | ||
run: chmod +x gradlew | ||
- name: gradle 테스트 | ||
run: ./gradlew test --no-daemon | ||
- name: gradle 빌드 | ||
run: ./gradlew build -x test --no-daemon | ||
- name: build 폴더를 캐시에 저장 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-artifact | ||
path: build | ||
retention-days: 1 | ||
tag: | ||
name: 태그 생성 | ||
needs: build | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag_name: ${{ steps.tag_version.outputs.new_tag }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: mathieudutour/[email protected] | ||
id: tag_version | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.tag_version.outputs.new_tag }} | ||
release_name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
docker: | ||
name: 도커 이미지 빌드와 푸시 | ||
runs-on: ubuntu-latest | ||
needs: tag | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: build 가져오기 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build-artifact | ||
path: build | ||
- name: Docker Buildx 설치 | ||
uses: docker/setup-buildx-action@v2 | ||
- name: ghcr.io 로그인 | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: set lower case owner name | ||
run: | | ||
echo "OWNER_LC=${OWNER,,}" >> ${GITHUB_ENV} | ||
env: | ||
OWNER: '${{ github.repository_owner }}' | ||
- name: 빌드 앤 푸시 | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/${{ env.OWNER_LC }}/tredpick-1:${{ needs.tag.outputs.tag_name }}, | ||
ghcr.io/${{ env.OWNER_LC }}/tredpick-1:latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
deploy: | ||
name: 쿠버네티스 배포 | ||
needs: [tag, docker] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: azure/k8s-set-context@v2 | ||
with: | ||
method: kubeconfig | ||
kubeconfig: ${{ secrets.KUBE_CONFIG }} | ||
- run: | | ||
kubectl set image deployment.apps/tredpick-1 tredpick-1=ghcr.io/angelsooho/tredpick-1:${{ needs.tag.outputs.tag_name }} |
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,105 @@ | ||
name: 'work-2' | ||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/**' | ||
- 'src/**' | ||
- 'build.gradle' | ||
- 'Dockerfile' | ||
- 'readme.md' | ||
branches: | ||
- 'development' | ||
jobs: | ||
build: | ||
name: 빌드 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: application-secret.yml 생성 | ||
env: | ||
ACTIONS_STEP_DEBUG: true | ||
APPLICATION_SECRET: ${{ secrets.APPLICATION_SECRET_YML }} | ||
run: echo "$APPLICATION_SECRET" > src/main/resources/application-secret.yml | ||
- name: jdk 17 설치 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: 'gradle' | ||
- name: gradlew 실행 권한 부여 | ||
run: chmod +x gradlew | ||
- name: gradle 테스트 | ||
run: ./gradlew test --no-daemon | ||
- name: gradle 빌드 | ||
run: ./gradlew build -x test --no-daemon | ||
- name: build 폴더를 캐시에 저장 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-artifact | ||
path: build | ||
retention-days: 1 | ||
tag: | ||
name: 태그 생성 | ||
needs: build | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag_name: ${{ steps.tag_version.outputs.new_tag }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: mathieudutour/[email protected] | ||
id: tag_version | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.tag_version.outputs.new_tag }} | ||
release_name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
docker: | ||
name: 도커 이미지 빌드와 푸시 | ||
runs-on: ubuntu-latest | ||
needs: tag | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: build 가져오기 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build-artifact | ||
path: build | ||
- name: Docker Buildx 설치 | ||
uses: docker/setup-buildx-action@v2 | ||
- name: ghcr.io 로그인 | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: set lower case owner name | ||
run: | | ||
echo "OWNER_LC=${OWNER,,}" >> ${GITHUB_ENV} | ||
env: | ||
OWNER: '${{ github.repository_owner }}' | ||
- name: 빌드 앤 푸시 | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/${{ env.OWNER_LC }}/trendpick-1:${{ needs.tag.outputs.tag_name }}, | ||
ghcr.io/${{ env.OWNER_LC }}/trendpick-1:latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
deploy: | ||
name: 쿠버네티스 배포 | ||
needs: [tag, docker] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: azure/k8s-set-context@v2 | ||
with: | ||
method: kubeconfig | ||
kubeconfig: ${{ secrets.KUBE_CONFIG }} | ||
- run: | | ||
kubectl set image deployment.apps/trendpick-1 trendpick-1=ghcr.io/trandpick/trendpick-1:${{ needs.tag.outputs.tag_name }} | ||
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
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,5 @@ | ||
FROM openjdk:17-jdk-alpine | ||
ARG JAR_FILE=build/libs/*.jar | ||
COPY ${JAR_FILE} app.jar | ||
EXPOSE 8080 | ||
ENTRYPOINT ["java","-jar","-Dspring.profiles.active=prod","/app.jar"] |
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
TrendPick | ||
프로젝트 트렌드픽입니다. | ||
프로젝트 트렌드픽입니다. | ||
test 입니다. | ||
test 입니다. | ||
안녕하세요. 배포환경입니다. |
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
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
46 changes: 46 additions & 0 deletions
46
src/main/java/project/trendpick_pro/domain/answer/controller/AnswerController.java
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,46 @@ | ||
package project.trendpick_pro.domain.answer.controller; | ||
|
||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.*; | ||
import project.trendpick_pro.domain.answer.entity.dto.request.AnswerRequest; | ||
import project.trendpick_pro.domain.answer.entity.dto.response.AnswerResponse; | ||
import project.trendpick_pro.domain.answer.entity.form.AnswerForm; | ||
import project.trendpick_pro.domain.answer.service.AnswerService; | ||
import project.trendpick_pro.domain.common.base.rq.Rq; | ||
import project.trendpick_pro.domain.member.entity.Member; | ||
|
||
@Controller | ||
@RequiredArgsConstructor | ||
@RequestMapping("/trendpick/customerservice/answers") | ||
public class AnswerController { | ||
private final AnswerService answerService; | ||
private final Rq rq; | ||
|
||
@PreAuthorize("isAuthenticated()") | ||
@PostMapping("register/{askId}") | ||
public String register(@PathVariable Long askId, @Valid AnswerForm answerForm){ | ||
rq.CheckAdmin().get(); | ||
answerService.register(askId, answerForm); | ||
|
||
return "redirect:/trendpick/customerservice/asks/{askId}".formatted(askId); | ||
} | ||
@PreAuthorize("isAuthenticated()") | ||
@PostMapping("/delete/{answerId}") | ||
public String deleteAnswer(@PathVariable Long answerId){ | ||
rq.CheckAdmin().get(); | ||
AnswerResponse answerResponse = answerService.delete(answerId); | ||
|
||
return "redirect:/trendpick/customerservice/asks/%s".formatted(answerResponse.getAskId()); | ||
} | ||
|
||
@PreAuthorize("isAuthenticated()") | ||
@PostMapping("/moidfy/{answerId}") | ||
public String modifyAnswer(@PathVariable Long answerId, @Valid AnswerForm answerForm){ | ||
rq.CheckAdmin().get(); | ||
AnswerResponse answerResponse = answerService.modify(answerId, answerForm); | ||
return "redirect:/trendpick/customerservice/asks/%s".formatted(answerResponse.getAskId()); | ||
} | ||
} |
Oops, something went wrong.