diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 371f9cf..acfc281 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -13,26 +13,26 @@ 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 @@ -40,30 +40,32 @@ jobs: 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 &"