feat: 배차 계획 리스트 및 상세 조회 구현 #10
This file contains hidden or 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: CI/CD to Lightsail | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Build jar | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew bootJar -x test --no-daemon | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| run: | | |
| IMAGE_NAME=ghcr.io/turtletongtong/backend:latest | |
| docker build -t $IMAGE_NAME . | |
| docker push $IMAGE_NAME | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build-and-push | |
| env: | |
| DB_NAME: ${{ secrets.DB_NAME }} | |
| DB_USERNAME: ${{ secrets.DB_USERNAME }} | |
| DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
| MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }} | |
| JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
| GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Copy docker-compose to server | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ${{ secrets.SSH_USER }} | |
| key: ${{ secrets.SSH_KEY }} | |
| source: "docker-compose.prod.yml" | |
| target: "/srv/turtleconnect" | |
| overwrite: true | |
| - name: Deploy over SSH | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ${{ secrets.SSH_USER }} | |
| key: ${{ secrets.SSH_KEY }} | |
| envs: DB_NAME,DB_USERNAME,DB_PASSWORD,MYSQL_ROOT_PASSWORD,JWT_SECRET,GHCR_TOKEN | |
| script: | | |
| cd /srv/turtleconnect | |
| docker login ghcr.io -u froggy-hyun -p "$GHCR_TOKEN" | |
| docker compose -f docker-compose.prod.yml pull | |
| docker compose -f docker-compose.prod.yml up -d | |
| docker image prune -f |