Skip to content

Commit

Permalink
Update gradle.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
DongJun1110 authored Aug 27, 2024
1 parent de417ed commit 3fc6bfc
Showing 1 changed file with 44 additions and 42 deletions.
86 changes: 44 additions & 42 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,57 +13,59 @@ jobs:
contents: read

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Set YML
run: |
mkdir -p src/main/resources
echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > src/main/resources/application.yml
find src
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: foreggcicd
path: build/libs/*.jar
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Set YML
run: |
mkdir -p src/main/resources
echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > src/main/resources/application.yml
find src
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: foreggcicd
path: build/libs/*.jar

dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: foreggcicd
- name: Setup SSH
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: SCP transfer
run: scp build/libs/*.jar ${{ secrets.SSH_USERNAME }}@${{ secrets.SERVER_IP }}:~/cicd
- name: Execute remote commands
run: |
ssh ${{ secrets.SSH_USERNAME }}@${{ secrets.SERVER_IP }} "sudo fuser -k 8080/tcp"
ssh ${{ secrets.SSH_USERNAME }}@${{ secrets.SERVER_IP }} "sudo nohup java -jar ~/cicd/*.jar &"
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: foreggcicd
- name: List files in build/libs
run: ls -la build/libs
- name: Setup SSH
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: SCP transfer
run: scp build/libs/*.jar ${{ secrets.SSH_USERNAME }}@${{ secrets.SERVER_IP }}:~/cicd
- name: Execute remote commands
run: |
ssh ${{ secrets.SSH_USERNAME }}@${{ secrets.SERVER_IP }} "sudo fuser -k 8080/tcp"
ssh ${{ secrets.SSH_USERNAME }}@${{ secrets.SERVER_IP }} "sudo nohup java -jar ~/cicd/foreggserver-0.0.1-SNAPSHOT.jar &"

0 comments on commit 3fc6bfc

Please sign in to comment.