From bcb98da50d2a346974735a63880f7364f4025890 Mon Sep 17 00:00:00 2001 From: jiyunio <146628970+jiyunio@users.noreply.github.com> Date: Thu, 9 May 2024 18:06:39 +0900 Subject: [PATCH] =?UTF-8?q?[Create]=20CI/CD=20=ED=8C=8C=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cicd.yml | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/cicd.yml diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..ac90267 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,49 @@ +name: CI/CD + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + + - name: Set Java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Run build with Gradle Wrapper + run: ./gradlew build + + - name: Send file to the server + uses: appleboy/scp-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USER }} + password: ${{ secrets.PASSWORD }} + port: ${{ secrets.SSH_PORT }} + source: "./build/libs/*.jar" + target: download + + - name: Deploy remote ssh commands using password + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USER }} + password: ${{ secrets.PASSWORD }} + port: ${{ secrets.SSH_PORT }} + script_stop: true + script: | + sh deploy/deploy.sh