From 2402c3854edceacbff040b1fd2681ab97d37d49b Mon Sep 17 00:00:00 2001 From: Vladyslav Heneraliuk Date: Thu, 25 Jan 2024 14:51:39 +0200 Subject: [PATCH 1/9] testing server bin files update --- .github/workflows/release.yml | 73 ++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f767f54..9882ced 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,43 +13,52 @@ on: run-name: Release ${{ inputs.release-version }} (${{ inputs.release-title }}) jobs: release_firmware: - if: ${{ github.ref_name == 'master' }} +# if: ${{ github.ref_name == 'master' }} runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v4 - - name: Replace version in firmware source - run: | - sed -i "s/String VERSION = \".*\";/String VERSION = \"${{ inputs.release-version }}\";/" ${{ github.workspace }}/src/firmware/firmware.ino - - name: Compile firmware - uses: ./.github/workflows/firmware-compile - - name: Copy release files to bin folder - run: | - cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin/${{ inputs.release-version }}.bin - cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin/latest.bin - - name: Commit changes - id: commit_changes - uses: stefanzweifel/git-auto-commit-action@v5 +# - name: Replace version in firmware source +# run: | +# sed -i "s/String VERSION = \".*\";/String VERSION = \"${{ inputs.release-version }}\";/" ${{ github.workspace }}/src/firmware/firmware.ino +# - name: Compile firmware +# uses: ./.github/workflows/firmware-compile +# - name: Copy release files to bin folder +# run: | +# cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin/${{ inputs.release-version }}.bin +# cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin/latest.bin +# - name: Commit changes +# id: commit_changes +# uses: stefanzweifel/git-auto-commit-action@v5 +# with: +# commit_message: "Release ${{ inputs.release-version }}" +# file_pattern: ${{ github.workspace }}/src/firmware/firmware.ino ${{ github.workspace }}/bin/ +# - name: Create Release +# uses: ncipollo/release-action@v1 +# with: +# artifacts: ${{ github.workspace }}/bin/${{ inputs.release-version }}.bin +# name: "${{ inputs.release-version }}: ${{ inputs.release-title }}" +# commit: ${{ steps.commit_changes.outputs.commit_hash }} +# tag: ${{ inputs.release-version }} +# generateReleaseNotes: true +# allowUpdates: true +# - name: Merge master -> develop +# uses: devmasx/merge-branch@master +# with: +# type: now +# target_branch: develop +# head_to_merge: ${{ steps.commit_changes.outputs.commit_hash }} +# message: Sync Release ${{ inputs.release-version }} to develop +# github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Update server bin list + uses: appleboy/ssh-action@v1.0.3 with: - commit_message: "Release ${{ inputs.release-version }}" - file_pattern: ${{ github.workspace }}/src/firmware/firmware.ino ${{ github.workspace }}/bin/ - - name: Create Release - uses: ncipollo/release-action@v1 - with: - artifacts: ${{ github.workspace }}/bin/${{ inputs.release-version }}.bin - name: "${{ inputs.release-version }}: ${{ inputs.release-title }}" - commit: ${{ steps.commit_changes.outputs.commit_hash }} - tag: ${{ inputs.release-version }} - generateReleaseNotes: true - allowUpdates: true - - name: Merge master -> develop - uses: devmasx/merge-branch@master - with: - type: now - target_branch: develop - head_to_merge: ${{ steps.commit_changes.outputs.commit_hash }} - message: Sync Release ${{ inputs.release-version }} to develop - github_token: ${{ secrets.GITHUB_TOKEN }} + host: ${{ secrets.SERVER_IP }} + username: ${{ secrets.SERVER_SSH_USER }} + password: ${{ secrets.SERVER_SSH_PASSWORD }} + script: | + cd /root/ukraine_alarm_map/deploy/ + bash redeploy_update_server.sh -s '/root/ukraine_alarm_map/bin' From eb1a0f117b8d32d52e63c2239ca9ed45e8aefdbd Mon Sep 17 00:00:00 2001 From: Vladyslav Heneraliuk Date: Thu, 25 Jan 2024 15:07:13 +0200 Subject: [PATCH 2/9] added checkout to master branch --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9882ced..b2c2023 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,5 +60,6 @@ jobs: password: ${{ secrets.SERVER_SSH_PASSWORD }} script: | cd /root/ukraine_alarm_map/deploy/ + git checkout master bash redeploy_update_server.sh -s '/root/ukraine_alarm_map/bin' From 974eed489022e3980376e5f1abbab2c948dfe11c Mon Sep 17 00:00:00 2001 From: Vladyslav Heneraliuk Date: Thu, 25 Jan 2024 15:11:09 +0200 Subject: [PATCH 3/9] restored release steps --- .github/workflows/release.yml | 66 +++++++++++++++++------------------ 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b2c2023..83df914 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,45 +13,45 @@ on: run-name: Release ${{ inputs.release-version }} (${{ inputs.release-title }}) jobs: release_firmware: -# if: ${{ github.ref_name == 'master' }} + if: ${{ github.ref_name == 'master' }} runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v4 -# - name: Replace version in firmware source -# run: | -# sed -i "s/String VERSION = \".*\";/String VERSION = \"${{ inputs.release-version }}\";/" ${{ github.workspace }}/src/firmware/firmware.ino -# - name: Compile firmware -# uses: ./.github/workflows/firmware-compile -# - name: Copy release files to bin folder -# run: | -# cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin/${{ inputs.release-version }}.bin -# cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin/latest.bin -# - name: Commit changes -# id: commit_changes -# uses: stefanzweifel/git-auto-commit-action@v5 -# with: -# commit_message: "Release ${{ inputs.release-version }}" -# file_pattern: ${{ github.workspace }}/src/firmware/firmware.ino ${{ github.workspace }}/bin/ -# - name: Create Release -# uses: ncipollo/release-action@v1 -# with: -# artifacts: ${{ github.workspace }}/bin/${{ inputs.release-version }}.bin -# name: "${{ inputs.release-version }}: ${{ inputs.release-title }}" -# commit: ${{ steps.commit_changes.outputs.commit_hash }} -# tag: ${{ inputs.release-version }} -# generateReleaseNotes: true -# allowUpdates: true -# - name: Merge master -> develop -# uses: devmasx/merge-branch@master -# with: -# type: now -# target_branch: develop -# head_to_merge: ${{ steps.commit_changes.outputs.commit_hash }} -# message: Sync Release ${{ inputs.release-version }} to develop -# github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Replace version in firmware source + run: | + sed -i "s/String VERSION = \".*\";/String VERSION = \"${{ inputs.release-version }}\";/" ${{ github.workspace }}/src/firmware/firmware.ino + - name: Compile firmware + uses: ./.github/workflows/firmware-compile + - name: Copy release files to bin folder + run: | + cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin/${{ inputs.release-version }}.bin + cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin/latest.bin + - name: Commit changes + id: commit_changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "Release ${{ inputs.release-version }}" + file_pattern: ${{ github.workspace }}/src/firmware/firmware.ino ${{ github.workspace }}/bin/ + - name: Create Release + uses: ncipollo/release-action@v1 + with: + artifacts: ${{ github.workspace }}/bin/${{ inputs.release-version }}.bin + name: "${{ inputs.release-version }}: ${{ inputs.release-title }}" + commit: ${{ steps.commit_changes.outputs.commit_hash }} + tag: ${{ inputs.release-version }} + generateReleaseNotes: true + allowUpdates: true + - name: Merge master -> develop + uses: devmasx/merge-branch@master + with: + type: now + target_branch: develop + head_to_merge: ${{ steps.commit_changes.outputs.commit_hash }} + message: Sync Release ${{ inputs.release-version }} to develop + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Update server bin list uses: appleboy/ssh-action@v1.0.3 with: From 51b6212d7efa302d0c0bc21f8a21c0f96322d856 Mon Sep 17 00:00:00 2001 From: Vladyslav Heneraliuk Date: Thu, 25 Jan 2024 16:37:23 +0200 Subject: [PATCH 4/9] added action --- .github/workflows/deploy_server.yml | 134 ++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 .github/workflows/deploy_server.yml diff --git a/.github/workflows/deploy_server.yml b/.github/workflows/deploy_server.yml new file mode 100644 index 0000000..353dbcc --- /dev/null +++ b/.github/workflows/deploy_server.yml @@ -0,0 +1,134 @@ +name: ☁️ Deploy Microservices +on: + workflow_dispatch: + inputs: + redeploy_all: + type: boolean + default: false + description: Redeploy all (be careful!) + redeploy_tcp_sockets: + type: boolean + default: false + description: TCP Sockets + redeploy_update_server: + type: boolean + default: false + description: Update server (bin list) + redeploy_web_server: + type: boolean + default: false + description: Web server + redeploy_alerts: + type: boolean + default: false + description: Alerts + redeploy_weather: + type: boolean + default: false + description: Weather + redeploy_updater: + type: boolean + default: false + description: Updater + redeploy_svg_generator: + type: boolean + default: false + description: SVG Generator + redeploy_explosions: + type: boolean + default: false + description: Explosions + +run-name: Deploy Microservices from '${{ github.ref_name }}' branch +jobs: + deploy_microservices: + runs-on: ubuntu-latest + steps: + - name: Redeploy TCP Sockets + if: inputs.redeploy_tcp_sockets == 'true' || inputs.redeploy_all == 'true' + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_IP }} + username: ${{ secrets.SERVER_SSH_USER }} + password: ${{ secrets.SERVER_SSH_PASSWORD }} + script: | + cd /root/ukraine_alarm_map/deploy/ + git checkout ${{ github.ref_name }} + bash redeploy_tcp_server.sh -m ${{ secrets.MEMCACHED_HOST }} + - name: Redeploy Update Server (bin list) + if: inputs.redeploy_update_server == 'true' || inputs.redeploy_all == 'true' + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_IP }} + username: ${{ secrets.SERVER_SSH_USER }} + password: ${{ secrets.SERVER_SSH_PASSWORD }} + script: | + cd /root/ukraine_alarm_map/deploy/ + git checkout ${{ github.ref_name }} + bash redeploy_update_server.sh -s '/root/ukraine_alarm_map/bin' + - name: Redeploy Web Server + if: inputs.redeploy_web_server == 'true' || inputs.redeploy_all == 'true' + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_IP }} + username: ${{ secrets.SERVER_SSH_USER }} + password: ${{ secrets.SERVER_SSH_PASSWORD }} + script: | + cd /root/ukraine_alarm_map/deploy/ + git checkout ${{ github.ref_name }} + bash redeploy_web_server.sh -d ${{ secrets.WEB_TOKEN }} -p 80 -m ${{ secrets.MEMCACHED_HOST }} + - name: Redeploy Alerts + if: inputs.redeploy_alerts == 'true' || inputs.redeploy_all == 'true' + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_IP }} + username: ${{ secrets.SERVER_SSH_USER }} + password: ${{ secrets.SERVER_SSH_PASSWORD }} + script: | + cd /root/ukraine_alarm_map/deploy/ + git checkout ${{ github.ref_name }} + bash redeploy_alerts.sh -a ${{ secrets.AIR_ALARM_API_KEY }} -m ${{ secrets.MEMCACHED_HOST }} + - name: Redeploy Weather + if: inputs.redeploy_weather == 'true' || inputs.redeploy_all == 'true' + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_IP }} + username: ${{ secrets.SERVER_SSH_USER }} + password: ${{ secrets.SERVER_SSH_PASSWORD }} + script: | + cd /root/ukraine_alarm_map/deploy/ + git checkout ${{ github.ref_name }} + bash redeploy_weather.sh -w ${{ secrets.WEATHER_TOKEN }} -m ${{ secrets.MEMCACHED_HOST }} + - name: Redeploy Updater + if: inputs.redeploy_updater == 'true' || inputs.redeploy_all == 'true' + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_IP }} + username: ${{ secrets.SERVER_SSH_USER }} + password: ${{ secrets.SERVER_SSH_PASSWORD }} + script: | + cd /root/ukraine_alarm_map/deploy/ + git checkout ${{ github.ref_name }} + bash redeploy_updater.sh -m ${{ secrets.MEMCACHED_HOST }} + - name: Redeploy Svg Generator + if: inputs.redeploy_svg_generator == 'true' || inputs.redeploy_all == 'true' + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_IP }} + username: ${{ secrets.SERVER_SSH_USER }} + password: ${{ secrets.SERVER_SSH_PASSWORD }} + script: | + cd /root/ukraine_alarm_map/deploy/ + git checkout ${{ github.ref_name }} + bash redeploy_svg_generator.sh -m ${{ secrets.MEMCACHED_HOST }} + - name: Redeploy Explosions + if: inputs.redeploy_explosions == 'true' || inputs.redeploy_all == 'true' + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_IP }} + username: ${{ secrets.SERVER_SSH_USER }} + password: ${{ secrets.SERVER_SSH_PASSWORD }} + script: | + cd /root/ukraine_alarm_map/deploy/ + git checkout ${{ github.ref_name }} + bash redeploy_explosions.sh -e ${{ secrets.ETRYVOGA_HOST }} -m ${{ secrets.MEMCACHED_HOST }} From 09a12b732762514eeb6b57a0cdfeb221bc101feb Mon Sep 17 00:00:00 2001 From: Vladyslav Heneraliuk Date: Thu, 25 Jan 2024 17:22:12 +0200 Subject: [PATCH 5/9] fixed 'if' statement --- .github/workflows/deploy_server.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy_server.yml b/.github/workflows/deploy_server.yml index 353dbcc..069acdb 100644 --- a/.github/workflows/deploy_server.yml +++ b/.github/workflows/deploy_server.yml @@ -45,7 +45,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Redeploy TCP Sockets - if: inputs.redeploy_tcp_sockets == 'true' || inputs.redeploy_all == 'true' + if: ${{ inputs.redeploy_tcp_sockets == 'true' || inputs.redeploy_all == 'true' }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -56,7 +56,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_tcp_server.sh -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Update Server (bin list) - if: inputs.redeploy_update_server == 'true' || inputs.redeploy_all == 'true' + if: ${{ inputs.redeploy_update_server == 'true' || inputs.redeploy_all == 'true' }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -67,7 +67,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_update_server.sh -s '/root/ukraine_alarm_map/bin' - name: Redeploy Web Server - if: inputs.redeploy_web_server == 'true' || inputs.redeploy_all == 'true' + if: ${{ inputs.redeploy_web_server == 'true' || inputs.redeploy_all == 'true' }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -78,7 +78,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_web_server.sh -d ${{ secrets.WEB_TOKEN }} -p 80 -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Alerts - if: inputs.redeploy_alerts == 'true' || inputs.redeploy_all == 'true' + if: ${{ inputs.redeploy_alerts == 'true' || inputs.redeploy_all == 'true' }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -89,7 +89,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_alerts.sh -a ${{ secrets.AIR_ALARM_API_KEY }} -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Weather - if: inputs.redeploy_weather == 'true' || inputs.redeploy_all == 'true' + if: ${{ inputs.redeploy_weather == 'true' || inputs.redeploy_all == 'true' }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -100,7 +100,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_weather.sh -w ${{ secrets.WEATHER_TOKEN }} -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Updater - if: inputs.redeploy_updater == 'true' || inputs.redeploy_all == 'true' + if: ${{ inputs.redeploy_updater == 'true' || inputs.redeploy_all == 'true' }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -111,7 +111,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_updater.sh -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Svg Generator - if: inputs.redeploy_svg_generator == 'true' || inputs.redeploy_all == 'true' + if: ${{ inputs.redeploy_svg_generator == 'true' || inputs.redeploy_all == 'true' }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -122,7 +122,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_svg_generator.sh -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Explosions - if: inputs.redeploy_explosions == 'true' || inputs.redeploy_all == 'true' + if: ${{ inputs.redeploy_explosions == 'true' || inputs.redeploy_all == 'true' }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} From 8408fa854263a714aa5616b6d28e9f026c481b99 Mon Sep 17 00:00:00 2001 From: Vladyslav Heneraliuk Date: Thu, 25 Jan 2024 17:45:56 +0200 Subject: [PATCH 6/9] fixed 'if' (part 2) --- .github/workflows/deploy_server.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy_server.yml b/.github/workflows/deploy_server.yml index 069acdb..ab2a6d5 100644 --- a/.github/workflows/deploy_server.yml +++ b/.github/workflows/deploy_server.yml @@ -45,7 +45,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Redeploy TCP Sockets - if: ${{ inputs.redeploy_tcp_sockets == 'true' || inputs.redeploy_all == 'true' }} + if: ${{ inputs.redeploy_tcp_sockets || inputs.redeploy_all }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -56,7 +56,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_tcp_server.sh -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Update Server (bin list) - if: ${{ inputs.redeploy_update_server == 'true' || inputs.redeploy_all == 'true' }} + if: ${{ inputs.redeploy_update_server || inputs.redeploy_all }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -67,7 +67,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_update_server.sh -s '/root/ukraine_alarm_map/bin' - name: Redeploy Web Server - if: ${{ inputs.redeploy_web_server == 'true' || inputs.redeploy_all == 'true' }} + if: ${{ inputs.redeploy_web_server || inputs.redeploy_all }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -78,7 +78,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_web_server.sh -d ${{ secrets.WEB_TOKEN }} -p 80 -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Alerts - if: ${{ inputs.redeploy_alerts == 'true' || inputs.redeploy_all == 'true' }} + if: ${{ inputs.redeploy_alerts || inputs.redeploy_all }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -89,7 +89,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_alerts.sh -a ${{ secrets.AIR_ALARM_API_KEY }} -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Weather - if: ${{ inputs.redeploy_weather == 'true' || inputs.redeploy_all == 'true' }} + if: ${{ inputs.redeploy_weather || inputs.redeploy_all }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -100,7 +100,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_weather.sh -w ${{ secrets.WEATHER_TOKEN }} -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Updater - if: ${{ inputs.redeploy_updater == 'true' || inputs.redeploy_all == 'true' }} + if: ${{ inputs.redeploy_updater || inputs.redeploy_all }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -111,7 +111,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_updater.sh -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Svg Generator - if: ${{ inputs.redeploy_svg_generator == 'true' || inputs.redeploy_all == 'true' }} + if: ${{ inputs.redeploy_svg_generator || inputs.redeploy_all }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} @@ -122,7 +122,7 @@ jobs: git checkout ${{ github.ref_name }} bash redeploy_svg_generator.sh -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Explosions - if: ${{ inputs.redeploy_explosions == 'true' || inputs.redeploy_all == 'true' }} + if: ${{ inputs.redeploy_explosions || inputs.redeploy_all }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_IP }} From 80c8aa7f48ba6a7c8f559c4029820c02248816a9 Mon Sep 17 00:00:00 2001 From: Vladyslav Heneraliuk Date: Thu, 25 Jan 2024 17:57:03 +0200 Subject: [PATCH 7/9] added 'git fetch' command --- .github/workflows/deploy_server.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/deploy_server.yml b/.github/workflows/deploy_server.yml index ab2a6d5..b0cb377 100644 --- a/.github/workflows/deploy_server.yml +++ b/.github/workflows/deploy_server.yml @@ -53,6 +53,7 @@ jobs: password: ${{ secrets.SERVER_SSH_PASSWORD }} script: | cd /root/ukraine_alarm_map/deploy/ + git fetch --all git checkout ${{ github.ref_name }} bash redeploy_tcp_server.sh -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Update Server (bin list) @@ -64,6 +65,7 @@ jobs: password: ${{ secrets.SERVER_SSH_PASSWORD }} script: | cd /root/ukraine_alarm_map/deploy/ + git fetch --all git checkout ${{ github.ref_name }} bash redeploy_update_server.sh -s '/root/ukraine_alarm_map/bin' - name: Redeploy Web Server @@ -75,6 +77,7 @@ jobs: password: ${{ secrets.SERVER_SSH_PASSWORD }} script: | cd /root/ukraine_alarm_map/deploy/ + git fetch --all git checkout ${{ github.ref_name }} bash redeploy_web_server.sh -d ${{ secrets.WEB_TOKEN }} -p 80 -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Alerts @@ -86,6 +89,7 @@ jobs: password: ${{ secrets.SERVER_SSH_PASSWORD }} script: | cd /root/ukraine_alarm_map/deploy/ + git fetch --all git checkout ${{ github.ref_name }} bash redeploy_alerts.sh -a ${{ secrets.AIR_ALARM_API_KEY }} -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Weather @@ -97,6 +101,7 @@ jobs: password: ${{ secrets.SERVER_SSH_PASSWORD }} script: | cd /root/ukraine_alarm_map/deploy/ + git fetch --all git checkout ${{ github.ref_name }} bash redeploy_weather.sh -w ${{ secrets.WEATHER_TOKEN }} -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Updater @@ -108,6 +113,7 @@ jobs: password: ${{ secrets.SERVER_SSH_PASSWORD }} script: | cd /root/ukraine_alarm_map/deploy/ + git fetch --all git checkout ${{ github.ref_name }} bash redeploy_updater.sh -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Svg Generator @@ -119,6 +125,7 @@ jobs: password: ${{ secrets.SERVER_SSH_PASSWORD }} script: | cd /root/ukraine_alarm_map/deploy/ + git fetch --all git checkout ${{ github.ref_name }} bash redeploy_svg_generator.sh -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Explosions @@ -130,5 +137,6 @@ jobs: password: ${{ secrets.SERVER_SSH_PASSWORD }} script: | cd /root/ukraine_alarm_map/deploy/ + git fetch --all git checkout ${{ github.ref_name }} bash redeploy_explosions.sh -e ${{ secrets.ETRYVOGA_HOST }} -m ${{ secrets.MEMCACHED_HOST }} From aaffe986ebf913479f266289fab4aace444b348e Mon Sep 17 00:00:00 2001 From: Vladyslav Heneraliuk Date: Thu, 25 Jan 2024 23:13:12 +0200 Subject: [PATCH 8/9] added 'git fetch' --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 83df914..31ad9d4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,6 +60,7 @@ jobs: password: ${{ secrets.SERVER_SSH_PASSWORD }} script: | cd /root/ukraine_alarm_map/deploy/ + git fetch --all git checkout master bash redeploy_update_server.sh -s '/root/ukraine_alarm_map/bin' From d30f34a7f3af0d93845a4a4ebc14e39fd53a1391 Mon Sep 17 00:00:00 2001 From: Vladyslav Heneraliuk Date: Fri, 26 Jan 2024 14:26:31 +0200 Subject: [PATCH 9/9] added polling interval --- .github/workflows/deploy_server.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy_server.yml b/.github/workflows/deploy_server.yml index b0cb377..54de2cc 100644 --- a/.github/workflows/deploy_server.yml +++ b/.github/workflows/deploy_server.yml @@ -22,6 +22,10 @@ on: type: boolean default: false description: Alerts + polling-interval: + type: number + default: 2 + description: Polling interval (seconds) redeploy_weather: type: boolean default: false @@ -91,7 +95,7 @@ jobs: cd /root/ukraine_alarm_map/deploy/ git fetch --all git checkout ${{ github.ref_name }} - bash redeploy_alerts.sh -a ${{ secrets.AIR_ALARM_API_KEY }} -m ${{ secrets.MEMCACHED_HOST }} + bash redeploy_alerts.sh -a ${{ secrets.AIR_ALARM_API_KEY }} -p ${{ inputs.polling-interval }} -m ${{ secrets.MEMCACHED_HOST }} - name: Redeploy Weather if: ${{ inputs.redeploy_weather || inputs.redeploy_all }} uses: appleboy/ssh-action@v1.0.3