Skip to content

feat: 토큰(AT, RT) 만료시간 설정 #104

feat: 토큰(AT, RT) 만료시간 설정

feat: 토큰(AT, RT) 만료시간 설정 #104

Workflow file for this run

name: jjakkak server deploy
# main branch -> push 이벤트 발생 시 실행
on:
push:
branches:
- develop
# job 설정
jobs:
build:
# ubuntu 환경 / 최신 버전
runs-on: ubuntu-latest
# step: 특정 작업을 수행하는 명령어
steps:
- name: Github Repository Load
uses: actions/checkout@v4
# jdk 17 세팅
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: application.properties 파일 생성
run: echo "${{ secrets.APPLICATION_PROPERTIES }}" > ./src/main/resources/application.properties
# 테스트 및 빌드 진행 (gradle)
- name: Build with Gradle
run: ./gradlew build
# AWS Credential 설정
- name: AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-northeast-2
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# ECR login
- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
# Docker image build
- name: Docker image build
run: docker build -t jjakkak-server .
# Docker tag
- name: Docker tag
run: docker tag jjakkak-server ${{ steps.login-ecr.outputs.registry }}/jjakkak-server:latest
# Docker push (ECR)
- name: Docker push
run: docker push ${{ steps.login-ecr.outputs.registry }}/jjakkak-server:latest
# ssh 접속 후 git pull 방식
- name: ssh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
script_stop: true
script: |
docker stop jjakkak-server || true
docker rm jjakkak-server || true
docker pull ${{ steps.login-ecr.outputs.registry }}/jjakkak-server:latest
docker run -d --name jjakkak-server -p 8080:8080 ${{ steps.login-ecr.outputs.registry }}/jjakkak-server:latest