Skip to content

[#94] 토큰 관리 기능 RDBMS(MySql) 이용하는 방안으로 구현 #166

[#94] 토큰 관리 기능 RDBMS(MySql) 이용하는 방안으로 구현

[#94] 토큰 관리 기능 RDBMS(MySql) 이용하는 방안으로 구현 #166

name: CI/CD Pipeline
on:
push:
branches:
- 'feature/*'
pull_request:
branches:
- dev
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: List files after checkout
run: ls -la
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build
env:
JASYPT_PASSWORD: ${{ secrets.JASYPT_PASSWORD }}
version: ${{ secrets.VERSION }}
buildTime: ${{ secrets.BUILDTIME }}
- name: Run tests
run: ./gradlew test
env:
JASYPT_PASSWORD: ${{ secrets.JASYPT_PASSWORD }}
version: ${{ secrets.VERSION }}
buildTime: ${{ secrets.BUILDTIME }}
build_and_deploy:
runs-on: ubuntu-latest
needs: build_and_test
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'dev'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Check JASYPT_PASSWORD environment variable
run: |
if [ -z "${{ secrets.JASYPT_PASSWORD }}" ]; then
echo "JASYPT_PASSWORD is not set."
exit 1
else
echo "JASYPT_PASSWORD is set."
fi
- name: Build with Gradle
run: ./gradlew build
env:
JASYPT_PASSWORD: ${{ secrets.JASYPT_PASSWORD }}
version: ${{ secrets.VERSION }}
buildTime: ${{ secrets.BUILDTIME }}
- name: Make zip file
run: zip -r ./$GITHUB_SHA.zip .
shell: bash
- name: Access to AWS
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://${{ secrets.S3_BUCKET_NAME }}/deploy/$GITHUB_SHA.zip
- name: Code Deploy
run: aws deploy create-deployment --application-name climingo-api
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name climingo-api-codeDeploy
--s3-location bucket=${{ secrets.S3_BUCKET_NAME }},bundleType=zip,key=deploy/$GITHUB_SHA.zip