Skip to content

Commit

Permalink
Merge pull request #163 from Yanabada/feature/161
Browse files Browse the repository at this point in the history
API 버전 명시 및 Release 브랜치 배포 스크립트 작성
  • Loading branch information
Programmer-may authored Jan 24, 2024
2 parents 579f43d + 6941ce2 commit fb99b55
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 9 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/cd-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Java CI with Gradle

on:
push:
branches: [ release ]

permissions:
contents: read

jobs:
build-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: application.yml
run: |
mkdir -p src/main/resources
touch ./src/main/resources/application.yml
echo "${{ secrets.RELEASE_APPLICATION_YML }}" > ./src/main/resources/application.yml
cat ./src/main/resources/application.yml
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: build -x test
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: build-file
path: build/libs/*.jar

deploy:
needs: build-release
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: build-file
- name: Setup SSH
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.RELEASE_SSH_PRIVATE_KEY }}
- name: Add remote server to known hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan ${{ secrets.RELEASE_SERVER_IP }} >> ~/.ssh/known_hosts
- name: SCP transfer
run: scp *.jar ${{ secrets.RELEASE_SERVER_USERNAME }}@${{ secrets.RELEASE_SERVER_IP }}:~/cicd
- name: Execute remote commands
run: |
ssh -v ${{ secrets.RELEASE_SERVER_USERNAME }}@${{ secrets.RELEASE_SERVER_IP }} "sudo fuser -k 80/tcp || true"
ssh -v ${{ secrets.RELEASE_SERVER_USERNAME }}@${{ secrets.RELEASE_SERVER_IP }} "sudo nohup /usr/bin/java -jar ~/cicd/*.jar > ~/cicd/nohup.log 2>&1 &"
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/accommodations")
@RequestMapping("/v1/accommodations")
@RequiredArgsConstructor
public class AccommodationController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/chats")
@RequestMapping("/v1/chats")
@RequiredArgsConstructor
public class ChatController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/member")
@RequestMapping("/v1/members")
public class MemberController {

private final MemberService memberService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/notifications")
@RequestMapping("/v1/notifications")
public class NotificationController {

private final NotificationService notificationService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/orders")
@RequestMapping("/v1/orders")
public class OrderController {

private final OrderService orderService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/payments")
@RequestMapping("/v1/payments")
@RequiredArgsConstructor
public class PaymentController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/trades")
@RequestMapping("/v1/trades")
public class TradeController {

private final TradeService tradeService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/products")
@RequestMapping("/v1/products")
public class ProductController {

private final ProductService productService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import jakarta.persistence.Table;
import java.time.LocalDate;
import java.time.LocalDateTime;
import kr.co.fastcampus.yanabada.common.baseentity.BaseEntity;
import kr.co.fastcampus.yanabada.domain.order.entity.Order;
import kr.co.fastcampus.yanabada.domain.product.entity.enums.ProductStatus;
import lombok.AccessLevel;
Expand All @@ -29,7 +30,7 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "product")
@Entity
public class Product {
public class Product extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down

0 comments on commit fb99b55

Please sign in to comment.