Skip to content

Signup seongjunnoh

Signup seongjunnoh #20

Workflow file for this run

name: Java CI with Gradle2141352
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: cicdsample
path: build/libs/*.jar
- name: Copy jar file to remote
uses: appleboy/scp-action@master
with:
username: ${{ secrets.EC2_USER }}
host: ${{ secrets.EC2_HOST }}
key: ${{ secrets.PRIVATE_KEY }}
source: "./build/libs/*.jar"
target: "/home/ubuntu/cicd"
strip_components: 2
- name: Copy deploy script file to remote
uses: appleboy/scp-action@master
with:
username: ${{ secrets.EC2_USER }}
host: ${{ secrets.EC2_HOST }}
key: ${{ secrets.PRIVATE_KEY }}
source: "deploy.sh"
target: "/home/ubuntu/cicd"
- name: Execute deploy script
uses: appleboy/ssh-action@master
with:
username: ${{ secrets.EC2_USER }}
host: ${{ secrets.EC2_HOST }}
key: ${{ secrets.PRIVATE_KEY }}
script_stop: true
script: |
chmod +x /home/ubuntu/cicd/deploy.sh
sh /home/ubuntu/cicd/deploy.sh