Skip to content

Commit

Permalink
Merge pull request #59 from pknu-wap/Fix/#58
Browse files Browse the repository at this point in the history
[Fix]12.20 Devfest 대비 회의 수정 사항 반영
  • Loading branch information
Zepelown authored Dec 20, 2024
2 parents 5594268 + 3042723 commit f0c0209
Show file tree
Hide file tree
Showing 11 changed files with 478 additions and 448 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build

on:
pull_request:
branches:
- develop
types:
- closed

jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Grant execute permission for gradlew
run: chmod +x ./wabi/gradlew

- name: Set environment values
run: |
touch ./wabi/src/main/resources/env.properties
echo "SPRING_DATASOURCE_URL=${{ secrets.SPRING_DATASOURCE_URL }}" >> ./env.properties
echo "SPRING_DATASOURCE_USERNAME=${{ secrets.SPRING_DATASOURCE_USERNAME }}" >> ./env.properties
echo "SPRING_DATASOURCE_PASSWORD=${{ secrets.SPRING_DATASOURCE_PASSWORD }}" >> ./env.properties
echo "JWT_KEY=${{ secrets.JWT_KEY }}" >> ./env.properties
echo "JWT_EXPIRATION_MINUTES=${{ secrets.JWT_EXPIRATION_MINUTES }}" >> ./env.properties
echo "JWT_REFRESH_EXPIRATION_HOURS=${{ secrets.JWT_REFRESH_EXPIRATION_HOURS }}" >> ./env.properties
echo "JWT_ISSUER=${{ secrets.JWT_ISSUER }}" >> ./env.properties
- name: Build with Gradle
run: |
cd wabi
./gradlew clean build -x test
- name: Docker build and push
run: |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:latest .
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:latest ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:${GITHUB_SHA::7}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:${GITHUB_SHA::7}
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy

on:
workflow_run:
workflows: ["Build"]
types:
- completed

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Set environment values
run: |
touch ./wabi/src/main/resources/env.properties
echo "SPRING_DATASOURCE_URL=${{ secrets.SPRING_DATASOURCE_URL }}" >> ./env.properties
echo "SPRING_DATASOURCE_USERNAME=${{ secrets.SPRING_DATASOURCE_USERNAME }}" >> ./env.properties
echo "SPRING_DATASOURCE_PASSWORD=${{ secrets.SPRING_DATASOURCE_PASSWORD }}" >> ./env.properties
echo "JWT_KEY=${{ secrets.JWT_KEY }}" >> ./env.properties
echo "JWT_EXPIRATION_MINUTES=${{ secrets.JWT_EXPIRATION_MINUTES }}" >> ./env.properties
echo "JWT_REFRESH_EXPIRATION_HOURS=${{ secrets.JWT_REFRESH_EXPIRATION_HOURS }}" >> ./env.properties
echo "JWT_ISSUER=${{ secrets.JWT_ISSUER }}" >> ./env.properties
- name: Deploy using Docker
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
script: |
#!/bin/bash
ls
cd /
sudo docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}
# Create .env file in the correct directory
echo "SPRING_DATASOURCE_URL=${{ secrets.SPRING_DATASOURCE_URL }}" | sudo tee -a .env > /dev/null
echo "SPRING_DATASOURCE_USERNAME=${{ secrets.SPRING_DATASOURCE_USERNAME }}" | sudo tee -a .env > /dev/null
echo "SPRING_DATASOURCE_PASSWORD=${{ secrets.SPRING_DATASOURCE_PASSWORD }}" | sudo tee -a .env > /dev/null
echo "JWT_KEY=${{ secrets.JWT_KEY }}" | sudo tee -a .env > /dev/null
echo "JWT_EXPIRATION_MINUTES=${{ secrets.JWT_EXPIRATION_MINUTES }}" | sudo tee -a .env > /dev/null
echo "JWT_REFRESH_EXPIRATION_HOURS=${{ secrets.JWT_REFRESH_EXPIRATION_HOURS }}" | sudo tee -a .env > /dev/null
echo "JWT_ISSUER=${{ secrets.JWT_ISSUER }}" | sudo tee -a .env > /dev/null
echo "DOCKERHUB_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}" | sudo tee -a .env > /dev/null
echo "DOCKERHUB_REPOSITORY=${{ secrets.DOCKERHUB_REPOSITORY }}" | sudo tee -a .env > /dev/null
sudo docker-compose down
sudo docker-compose up -d
27 changes: 0 additions & 27 deletions .github/workflows/docker-image.yml

This file was deleted.

97 changes: 0 additions & 97 deletions .github/workflows/gradle.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class JwtAuthenticationFilter(
val newAccessToken = jwtTokenProvider.recreateAccessToken(oldAccessToken)

// 새 액세스 토큰을 응답 헤더에 추가
response.setHeader("New-Access-Token", newAccessToken)
response.setHeader("newRefreshToken", newAccessToken)

// SecurityContext에 새 인증 정보 업데이트
val user = parseUserSpecification(newAccessToken)
Expand Down
5 changes: 3 additions & 2 deletions wabi/src/test/kotlin/com/wap/wabi/band/fixture/BandFixture.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package com.wap.wabi.band.fixture

import com.wap.wabi.band.entity.Band
import com.wap.wabi.common.Reflection
import com.wap.wabi.common.TestConstants

object BandFixture {
fun createBand(name: String): Band {
return Band.builder()
.adminId(1)
.adminId(TestConstants.ADMIN_ID)
.bandName(name)
.build()
}
Expand All @@ -18,7 +19,7 @@ object BandFixture {

fun createAnotherUserBand(name: String): Band {
return Band.builder()
.adminId(2)
.adminId(TestConstants.ANOTHER_ADMIN_ID)
.bandName(name)
.build()
}
Expand Down
Loading

0 comments on commit f0c0209

Please sign in to comment.