From f95f03cdd2210883164efc69c273c796ff7eff39 Mon Sep 17 00:00:00 2001 From: Victor Melnik Date: Thu, 8 Oct 2020 21:28:45 +0300 Subject: [PATCH 1/5] Create build.yml --- .github/workflows/build.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a905c50 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: build + +on: + push: + branches: [master, develop] + pull_request: + branches: [master, develop] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Build with Gradle + run: chmod +x gradlew && ./gradlew build From d7caf4a6a6be983ab290a3ff4269eae1d2294748 Mon Sep 17 00:00:00 2001 From: Victor Melnik Date: Thu, 8 Oct 2020 21:56:00 +0300 Subject: [PATCH 2/5] Create deploy.yml --- .github/workflows/deploy.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..54071cb --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,29 @@ +name: deploy + +on: + create: + tags: [v*] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Build app with Gradle + run: chmod +x gradlew && ./gradlew shadowJar + + - uses: actions/checkout@v2 + - name: Copy app to server + uses: appleboy/scp-action@v0.1.1 + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USER }} + password: ${{ secrets.SSH_PASS }} + port: ${{ secrets.SSH_PORT }} + source: "build/libs/SimilarImagesBot-1.0.2-all.jar" + target: "bots/similar-images-bot" From 1f2f4568614b225df68e9621ebd06009355afc69 Mon Sep 17 00:00:00 2001 From: Victor Melnik Date: Thu, 8 Oct 2020 22:01:12 +0300 Subject: [PATCH 3/5] Add workflow dispatch to deploy action --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 54071cb..d20dc62 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,6 +1,7 @@ name: deploy on: + workflow_dispatch: create: tags: [v*] From ea66ba5c3c89cd13d657ac43b30c9a591b28904f Mon Sep 17 00:00:00 2001 From: Victor Melnik Date: Thu, 8 Oct 2020 22:17:54 +0300 Subject: [PATCH 4/5] Update deploy.yml --- .github/workflows/deploy.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d20dc62..bac6548 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,13 +11,22 @@ jobs: steps: - uses: actions/checkout@v2 + # Build release - name: Set up JDK 11 uses: actions/setup-java@v1 with: java-version: 11 - name: Build app with Gradle run: chmod +x gradlew && ./gradlew shadowJar - + # Download from build to data + - uses: actions/upload-artifact@v2 + with: + path: build/libs/*.jar + # TODO remove + - name: Display structure of downloaded files + run: ls -R + working-directory: build/libs + # Upload from data to production server - uses: actions/checkout@v2 - name: Copy app to server uses: appleboy/scp-action@v0.1.1 @@ -26,5 +35,5 @@ jobs: username: ${{ secrets.SSH_USER }} password: ${{ secrets.SSH_PASS }} port: ${{ secrets.SSH_PORT }} - source: "build/libs/SimilarImagesBot-1.0.2-all.jar" + source: "build/libs/" target: "bots/similar-images-bot" From 896ad752764124a67475de5f7ab50d5a184fe416 Mon Sep 17 00:00:00 2001 From: Victor Melnik Date: Thu, 8 Oct 2020 22:33:20 +0300 Subject: [PATCH 5/5] Replace scp-action with github-action-scp --- .github/workflows/deploy.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bac6548..0dbcda6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -22,18 +22,13 @@ jobs: - uses: actions/upload-artifact@v2 with: path: build/libs/*.jar - # TODO remove - - name: Display structure of downloaded files - run: ls -R - working-directory: build/libs # Upload from data to production server - - uses: actions/checkout@v2 - - name: Copy app to server - uses: appleboy/scp-action@v0.1.1 + - name: Upload app to server + uses: garygrossgarten/github-action-scp@v0.6.0 with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USER }} password: ${{ secrets.SSH_PASS }} port: ${{ secrets.SSH_PORT }} - source: "build/libs/" - target: "bots/similar-images-bot" + local: "build/libs" + remote: "bots/similar-images-bot"