Update cd.yml #8
Workflow file for this run
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: Java CD with Gradle | |
on: | |
push: | |
branches: [ "dev" ] | |
permissions: | |
contents: read | |
jobs: | |
# build: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Checkout Repository | |
# uses: actions/checkout@v4 | |
# with: | |
# token: ${{ secrets.SUBMODULE_TOKEN }} | |
# submodules: recursive | |
# - name: Set up JDK 17 | |
# uses: actions/setup-java@v4 | |
# with: | |
# java-version: '17' | |
# distribution: 'temurin' | |
# - name: Setup Gradle | |
# uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | |
# - name: Build with Gradle Wrapper | |
# run: ./gradlew build | |
# - name: Upload artifact | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# path: build/libs/balance-talk-0.0.1-SNAPSHOT.jar | |
deploy: | |
# needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: SSH to EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USER }} | |
script: | | |
sudo fuser -k 80/tcp | |
cd Balance-Talk-Backend | |
git pull --recurse-submodules | |
./gradlew build | |
cd build/libs | |
sudo nohup java -jar balance-talk-0.0.1-SNAPSHOT.jar & |