Fix SignIn #50
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: CD | |
on: | |
push: | |
paths: | |
- '.github/workflows/**' | |
- 'Graduating-Server/**' | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Setting yaml file | |
# TODO: microsoft/variable-substitution is deprecated | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: Graduating-Server/src/main/resources/application.yml | |
env: | |
spring.datasource.url: ${{ secrets.DB_URL }} | |
spring.datasource.username: ${{ secrets.DB_USERNAME }} | |
spring.datasource.password: ${{ secrets.DB_PASSWORD }} | |
neis.apikey: ${{ secrets.NEIS_APIKEY }} | |
jwt.secret-key: ${{ secrets.JWT_SECRET }} | |
oauth2.google.client-id.ios: ${{ secrets.GOOGLE_CLIENT_ID_IOS }} | |
oauth2.google.client-id.web: ${{ secrets.GOOGLE_CLIENT_ID_WEB }} | |
oauth2.google.client-secret: ${{ secrets.GOOGLE_CLIENT_SECRET }} | |
oauth2.google.redirect-uri: ${{ secrets.GOOGLE_REDIRECT_URI }} | |
oauth2.apple.bundle-id: ${{ secrets.APPLE_BUNDLE_ID }} | |
oauth2.apple.key-id: ${{ secrets.APPLE_KEY_ID }} | |
oauth2.apple.team-id: ${{ secrets.APPLE_TEAM_ID }} | |
oauth2.apple.private-key: ${{ secrets.APPLE_P8_KEY }} | |
- name: Build with Gradle | |
run: | | |
cd ./Graduating-Server | |
./gradlew bootJar -x test | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: GraduatingServer | |
path: Graduating-Server/build/libs/Graduating-Server-0.0.1-SNAPSHOT.jar | |
distribute: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: GraduatingServer | |
path: dist | |
- name: Show downloaded files | |
run: ls -alh dist # TODO: -alh이 뭔지 검색 ㄱ | |
- name: EC2 Upload | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.REMOTE_IP }} | |
username: ${{ secrets.REMOTE_SSH_ID }} | |
key: ${{ secrets.REMOTE_SSH_KEY }} | |
port: ${{ secrets.REMOTE_SSH_PORT }} | |
source: "dist/*.jar" | |
target: /home/ubuntu/product | |
strip_components: 1 # Remove dist path | |
service_restart: | |
needs: distribute | |
runs-on: ubuntu-latest | |
steps: | |
- name: EC2 Run | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_IP }} | |
username: ${{ secrets.REMOTE_SSH_ID }} | |
key: ${{ secrets.REMOTE_SSH_KEY }} | |
port: ${{ secrets.REMOTE_SSH_PORT }} | |
script: | | |
cd /home/ubuntu/product | |
sh start.sh |