diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index 349f6d0..0000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: deploy -on: - workflow_run: - workflows: [ "Java CI with Gradle" ] - branches: [ 'master' ] - paths: - - 'main-server/**' - - 'logging-server/**' - types: - - completed -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3.3.0 - - - uses: dorny/paths-filter@v2.11.1 - id: changes - with: - filters: | - main: - - 'main-server/**' - logging: - - 'logging-server/**' - - - name: deploy main-server - if: steps.changes.outputs.front == 'true' - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.SERVER_HOST }} - username: ${{ secrets.SERVER_USERNAME }} - key: ${{ secrets.SERVER_SSH_KEY }} - passphrase: ${{ secrets.SERVER_PASSPHRASE }} - port: ${{ secrets.SERVER_SSH_PORT }} - script: | - sh ~/script/deploy-main-server.sh - - - name: deploy logging-server - if: steps.changes.outputs.back == 'true' - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.SERVER_HOST }} - username: ${{ secrets.SERVER_USERNAME }} - key: ${{ secrets.SERVER_SSH_KEY }} - passphrase: ${{ secrets.SERVER_PASSPHRASE }} - port: ${{ secrets.SERVER_SSH_PORT }} - script: | - sh ~/script/deploy-logging-server.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cac28a..6f159a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Java CI with Gradle +name: CI and CD on: push: @@ -8,7 +8,7 @@ permissions: contents: read jobs: - build: + integration: runs-on: ubuntu-latest steps: @@ -23,4 +23,42 @@ jobs: run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew clean build \ No newline at end of file + run: ./gradlew clean build + + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.3.0 + + - uses: dorny/paths-filter@v2.11.1 + id: changes + with: + filters: | + main: + - 'main-server/**' + logging: + - 'logging-server/**' + + - name: deploy main-server + if: steps.changes.outputs.front == 'true' + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USERNAME }} + key: ${{ secrets.SERVER_SSH_KEY }} + passphrase: ${{ secrets.SERVER_PASSPHRASE }} + port: ${{ secrets.SERVER_SSH_PORT }} + script: | + sh ~/script/deploy-main-server.sh + + - name: deploy logging-server + if: steps.changes.outputs.back == 'true' + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USERNAME }} + key: ${{ secrets.SERVER_SSH_KEY }} + passphrase: ${{ secrets.SERVER_PASSPHRASE }} + port: ${{ secrets.SERVER_SSH_PORT }} + script: | + sh ~/script/deploy-logging-server.sh diff --git a/logging-server/src/main/java/com/sickgyun/server/domain/logging/CorsConfig.java b/logging-server/src/main/java/com/sickgyun/server/domain/logging/CorsConfig.java index dcc5014..5a68289 100644 --- a/logging-server/src/main/java/com/sickgyun/server/domain/logging/CorsConfig.java +++ b/logging-server/src/main/java/com/sickgyun/server/domain/logging/CorsConfig.java @@ -16,6 +16,7 @@ public class CorsConfig implements WebMvcConfigurer { private static final String ALLOWED_METHODS = "*"; private static final String MAIN_SERVER_DOMAIN = "https://sickgyun.com"; private static final String FRONTEND_LOCALHOST = "http://localhost:3000"; + private static final String HTTPS_FRONTEND_LOCALHOST = "https://localhost:3000"; @Override public void addCorsMappings(CorsRegistry registry) { @@ -23,7 +24,8 @@ public void addCorsMappings(CorsRegistry registry) { .allowedMethods(ALLOWED_METHODS) .allowedOrigins( MAIN_SERVER_DOMAIN, - FRONTEND_LOCALHOST + FRONTEND_LOCALHOST, + HTTPS_FRONTEND_LOCALHOST ) .allowCredentials(true) .exposedHeaders(LOCATION, SET_COOKIE); diff --git a/main-server/src/main/java/com/sickgyun/server/common/config/InterceptorConfig.java b/main-server/src/main/java/com/sickgyun/server/common/config/InterceptorConfig.java index e40af94..b48c864 100644 --- a/main-server/src/main/java/com/sickgyun/server/common/config/InterceptorConfig.java +++ b/main-server/src/main/java/com/sickgyun/server/common/config/InterceptorConfig.java @@ -23,6 +23,7 @@ public class InterceptorConfig implements WebMvcConfigurer { private static final String ALLOWED_METHODS = "*"; private static final String MAIN_SERVER_DOMAIN = "https://sickgyun.com"; private static final String FRONTEND_LOCALHOST = "http://localhost:3000"; + private static final String HTTPS_FRONTEND_LOCALHOST = "https://localhost:3000"; private final JwtParser jwtParser; private final AuthUpdater authUpdater; @@ -35,7 +36,8 @@ public void addCorsMappings(CorsRegistry registry) { .allowedMethods(ALLOWED_METHODS) .allowedOrigins( MAIN_SERVER_DOMAIN, - FRONTEND_LOCALHOST + FRONTEND_LOCALHOST, + HTTPS_FRONTEND_LOCALHOST ) .allowCredentials(true) .exposedHeaders(LOCATION, SET_COOKIE);