Skip to content

Update auto-deployment.yml #15

Update auto-deployment.yml

Update auto-deployment.yml #15

name: AWS EC2 자동 배포
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.2
- name: Show git status
run: git status
- name: Setup Java JDK
uses: actions/setup-java@v4.2.1
with:
# The Java version to set up. Takes a whole or semver Java version. See examples of supported syntax in README file
java-version: 17
# Java distribution. See the list of supported distributions in README file
distribution: temurin
# The package type (jdk, jre, jdk+fx, jre+fx)
java-package: jdk
# The architecture of the package (defaults to the action runner's architecture)
architecture: x64
cache: gradle
- name: Build Jar
run: |
cd JWT
chmod 755 gradlew
./gradlew bootJar
./gradlew jarDir
- name: Connect to EC2
run: |
EC2_HOST={{ secrets.EC2_HOST }}
EC2_USERNAME={{ secrets.EC2_USERNAME }}
echo {{ secrets.EC2_PRIVATE_KEY }} > private_key.pem
ssh -i private_key.pem "${EC2_USERNAME}@${EC2_HOST}" echo hello