Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Build Gradle and Deploy
name: "[PROD] Build Gradle and Deploy"

on:
push:
branches: [ "release" ]
branches: [ "release" ] # todo: 스테이지 서버 cd 테스트 후 master 로 변경 필요
workflow_dispatch:

jobs:
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/stage-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: "[STAGE] Build Gradle and Deploy"

on:
push:
branches: [ "stage-test" ] # todo: 스테이지 서버 cd 테스트 후 release 로 변경 필요
workflow_dispatch:

jobs:
build-gradle:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
token: ${{ secrets.SUBMODULE_ACCESS_TOKEN }}
submodules: true

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0

- name: Grant execute permission for Gradle wrapper(gradlew)
run: chmod +x ./gradlew

- name: Build with Gradle
run: ./gradlew bootJar -Dspring.profiles.active=prod

- name: Copy jar file to remote
uses: appleboy/scp-action@master
with:
host: ${{ secrets.STAGE_HOST }}
username: ${{ secrets.STAGE_USERNAME }}
key: ${{ secrets.STAGE_PRIVATE_KEY }}
source: "./build/libs/*.jar"
target: "/home/${{ secrets.STAGE_USERNAME }}/solid-connect-stage/"

- name: Copy docker file to remote
uses: appleboy/scp-action@master
with:
host: ${{ secrets.STAGE_HOST }}
username: ${{ secrets.STAGE_USERNAME }}
key: ${{ secrets.STAGE_PRIVATE_KEY }}
source: "./Dockerfile"
target: "/home/${{ secrets.STAGE_USERNAME }}/solid-connect-stage/"

- name: Copy docker compose file to remote
uses: appleboy/scp-action@master
with:
host: ${{ secrets.STAGE_HOST }}
username: ${{ secrets.STAGE_USERNAME }}
key: ${{ secrets.STAGE_PRIVATE_KEY }}
source: "./docker-compose.yml"
target: "/home/${{ secrets.STAGE_USERNAME }}/solid-connect-stage/"

- name: Run docker compose
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.STAGE_HOST }}
username: ${{ secrets.STAGE_USERNAME }}
key: ${{ secrets.STAGE_PRIVATE_KEY }}
script_stop: true
script: |
cd /home/${{ secrets.STAGE_USERNAME }}/solid-connect-stage
docker compose down
docker compose up -d --build
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.example.solidconnection.community.post.dto.PostListResponse;
import com.example.solidconnection.community.post.service.PostQueryService;
import com.example.solidconnection.custom.resolver.AuthorizedUser;
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.type.BoardCode;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -33,6 +35,7 @@ public ResponseEntity<?> findAccessibleCodes() {

@GetMapping("/{code}")
public ResponseEntity<?> findPostsByCodeAndCategory(
@AuthorizedUser SiteUser siteUser,
@PathVariable(value = "code") String code,
@RequestParam(value = "category", defaultValue = "전체") String category) {
List<PostListResponse> postsByCodeAndPostCategory = postQueryService
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/secret