Merge remote-tracking branch 'origin/common' into social/dev #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SocialService CI/CD by jar | |
on: | |
push: | |
branches: | |
- 'social/dev' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
gradle- | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Grant execute permission for gradlew | |
run: chmod +x src/social-service/gradlew | |
- name: 프로젝트 빌드 | |
env: | |
EUREKA_HOST: ${{ secrets.EUREKA_HOST }} | |
EUREKA_DEFAULT_ZONE: ${{ secrets.EUREKA_DEFAULT_ZONE }} | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
AUTH_JWT_SECRET_KEY: ${{ secrets.AUTH_JWT_SECRET_KEY }} | |
AUTH_MAIL_HOST: ${{ secrets.AUTH_MAIL_HOST }} | |
AUTH_MAIL_PASSWORD: ${{ secrets.AUTH_MAIL_PASSWORD }} | |
AUTH_MAIL_PORT: ${{ secrets.AUTH_MAIL_PORT }} | |
AUTH_MAIL_USERNAME: ${{ secrets.AUTH_MAIL_USERNAME }} | |
AUTH_REDIS_HOST: ${{ secrets.AUTH_REDIS_HOST }} | |
AUTH_REDIS_PORT: ${{ secrets.AUTH_REDIS_PORT }} | |
USER_DB_URI: ${{ secrets.USER_DB_URI }} | |
USER_DB_USERNAME: ${{ secrets.USER_DB_USERNAME }} | |
USER_DB_USER_DB_PASSWORD: ${{ secrets.USER_DB_USER_DB_PASSWORD }} | |
SOCIAL_DB_URI: ${{ secrets.SOCIAL_DB_URI }} | |
SOCIAL_DB_USERNAME: ${{ secrets.SOCIAL_DB_USERNAME }} | |
SOCIAL_DB_PASSWORD: ${{ secrets.SOCIAL_DB_PASSWORD }} | |
TIMELINE_REDIS_HOST: ${{ secrets.TIMELINE_REDIS_HOST }} | |
TIMELINE_REDIS_PORT: ${{ secrets.TIMELINE_REDIS_PORT }} | |
TIMELINE_REDIS_PASSWORD: ${{ secrets.TIMELINE_REDIS_PASSWORD }} | |
NOTIFICATOIN_DB_URI: ${{ secrets.NOTIFICATOIN_DB_URI }} | |
NOTIFICATOIN_DB_USERNAME: ${{ secrets.NOTIFICATOIN_DB_USERNAME }} | |
NOTIFICATOIN_DB_USER_DB_PASSWORD: ${{ secrets.NOTIFICATOIN_DB_USER_DB_PASSWORD }} | |
LIGHTSAIL_HOST: ${{ secrets.LIGHTSAIL_HOST }} | |
LIGHTSAIL_KEY: ${{ secrets.LIGHTSAIL_KEY }} | |
LIGHTSAIL_USERNAME: ${{ secrets.LIGHTSAIL_USERNAME }} | |
PASSPORT_KEY: ${{ secrets.PASSPORT_KEY }} | |
PASSPORT_ALGORITHM: ${{ secrets.PASSPORT_ALGORITHM }} | |
KAFKA_SERVERS: ${{ secrets.KAFKA_SERVERS }} | |
working-directory: ./src/social-service | |
run: ./gradlew clean build -x test | |
shell: bash | |
- name: 빌드 파일 복사 | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.LIGHTSAIL_HOST }} | |
username: ${{ secrets.LIGHTSAIL_USERNAME }} | |
key: ${{ secrets.LIGHTSAIL_KEY }} | |
source: "src/social-service/build/libs/easel-social-service-0.0.1-SNAPSHOT.jar" | |
target: "/home/ubuntu/palette/social-service" | |
- name: LIGHTSAIL 인스턴스 접속 및 애플리케이션 실행 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.LIGHTSAIL_HOST }} | |
username: ${{ secrets.LIGHTSAIL_USERNAME }} | |
key: ${{ secrets.LIGHTSAIL_KEY }} | |
script: | | |
cd /home/ubuntu/palette/social-service | |
sudo su | |
./stop.sh | |
./operate.sh |