feat : 로그인 기반 구현 (#5) #12
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: CD with Gradle | |
| on: | |
| push: | |
| branches: [ "dev" ] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Create application.yml with secrets | |
| run: | | |
| mkdir -p src/main/resources | |
| echo "spring:" >> src/main/resources/application.yml | |
| echo " jwt:" >> src/main/resources/application.yml | |
| echo " secret: \"${{ secrets.JWT_SECRET }}\"" >> src/main/resources/application.yml | |
| echo " access-token-duration: 10D" >> src/main/resources/application.yml | |
| echo " refresh-token-duration: 100D" >> src/main/resources/application.yml | |
| echo " security:" >> src/main/resources/application.yml | |
| echo " oauth2:" >> src/main/resources/application.yml | |
| echo " client:" >> src/main/resources/application.yml | |
| echo " registration:" >> src/main/resources/application.yml | |
| echo " google:" >> src/main/resources/application.yml | |
| echo " client-id: \"${{ secrets.GOOGLE_CLIENT_ID }}\"" >> src/main/resources/application.yml | |
| echo " client-secret: \"${{ secrets.GOOGLE_CLIENT_SECRET }}\"" >> src/main/resources/application.yml | |
| echo " scope:" >> src/main/resources/application.yml | |
| echo " - email" >> src/main/resources/application.yml | |
| echo " - profile" >> src/main/resources/application.yml | |
| echo " redirect-uri: https://crame.site/login/oauth2/code/google" >> src/main/resources/application.yml | |
| echo " data:" >> src/main/resources/application.yml | |
| echo " mongodb:" >> src/main/resources/application.yml | |
| echo " uri: \"${{ secrets.MONGO_URI }}\"" >> src/main/resources/application.yml | |
| echo "springdoc:" >> src/main/resources/application.yml | |
| echo " swagger-ui:" >> src/main/resources/application.yml | |
| echo " path: /swagger-ui.html" >> src/main/resources/application.yml | |
| - name: Build with Gradle Wrapper | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew build -x test | |
| - name: Transfer .jar file to EC2 | |
| uses: appleboy/scp-action@master | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ubuntu | |
| key: ${{ secrets.SSH_KEY }} | |
| source: "build/libs/*.jar" | |
| target: "/home/ubuntu/crame" | |
| - name: Restart docker compose on EC2 | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ubuntu | |
| key: ${{ secrets.SSH_KEY }} | |
| script: | | |
| cd ~/crame | |
| docker compose up -d --build | |
| docker image prune -f |