Deploy Microservices from 'develop' branch #177
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: ☁️ Deploy Microservices | |
on: | |
workflow_dispatch: | |
inputs: | |
redeploy_all: | |
type: boolean | |
default: false | |
description: Redeploy all (be careful!) | |
redeploy_web_sockets: | |
type: boolean | |
default: false | |
description: WebSockets | |
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_etryvoga: | |
type: boolean | |
default: false | |
description: Etryvoga | |
run-name: Deploy Microservices from '${{ github.ref_name }}' branch | |
jobs: | |
deploy_microservices: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Redeploy WebSockets | |
if: ${{ inputs.redeploy_web_sockets || inputs.redeploy_all }} | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ secrets.CLOUD_SERVER_IP }} | |
username: ${{ secrets.CLOUD_SERVER_USER }} | |
key: ${{ secrets.CLOUD_SERVER_SSH_KEY }} | |
script: | | |
cd /root/ukraine_alarm_map/deploy/ | |
git fetch --all | |
git switch ${{ github.ref_name }} | |
git pull | |
bash redeploy_websocket_server.sh -m ${{ secrets.CLOUD_MEMCACHED_HOST }} -s ${{ secrets.API_SECRET }} -i ${{ secrets.MEASUREMENT_ID }} | |
- name: Redeploy Update Server (bin list) | |
if: ${{ inputs.redeploy_update_server || inputs.redeploy_all }} | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ secrets.CLOUD_SERVER_IP }} | |
username: ${{ secrets.CLOUD_SERVER_USER }} | |
key: ${{ secrets.CLOUD_SERVER_SSH_KEY }} | |
script: | | |
cd /root/ukraine_alarm_map/deploy/ | |
git fetch --all | |
git switch ${{ github.ref_name }} | |
git pull | |
bash redeploy_update_server.sh -s '/root/ukraine_alarm_map/bin' -sb '/root/ukraine_alarm_map/bin_beta' -m ${{ secrets.CLOUD_MEMCACHED_HOST }} | |
- name: Redeploy Web Server | |
if: ${{ inputs.redeploy_web_server || inputs.redeploy_all }} | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ secrets.CLOUD_SERVER_IP }} | |
username: ${{ secrets.CLOUD_SERVER_USER }} | |
key: ${{ secrets.CLOUD_SERVER_SSH_KEY }} | |
script: | | |
cd /root/ukraine_alarm_map/deploy/ | |
git fetch --all | |
git switch ${{ github.ref_name }} | |
git pull | |
bash redeploy_web_server.sh -d ${{ secrets.WEB_TOKEN }} -m ${{ secrets.CLOUD_MEMCACHED_HOST }} | |
- name: Redeploy Weather | |
if: ${{ inputs.redeploy_weather || inputs.redeploy_all }} | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ secrets.CLOUD_SERVER_IP }} | |
username: ${{ secrets.CLOUD_SERVER_USER }} | |
key: ${{ secrets.CLOUD_SERVER_SSH_KEY }} | |
script: | | |
cd /root/ukraine_alarm_map/deploy/ | |
git fetch --all | |
git switch ${{ github.ref_name }} | |
git pull | |
bash redeploy_weather.sh -w ${{ secrets.WEATHER_TOKEN }} -m ${{ secrets.CLOUD_MEMCACHED_HOST }} | |
- name: Redeploy Updater | |
if: ${{ inputs.redeploy_updater || inputs.redeploy_all }} | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ secrets.CLOUD_SERVER_IP }} | |
username: ${{ secrets.CLOUD_SERVER_USER }} | |
key: ${{ secrets.CLOUD_SERVER_SSH_KEY }} | |
script: | | |
cd /root/ukraine_alarm_map/deploy/ | |
git fetch --all | |
git switch ${{ github.ref_name }} | |
git pull | |
bash redeploy_updater.sh -m ${{ secrets.CLOUD_MEMCACHED_HOST }} | |
- name: Redeploy Svg Generator | |
if: ${{ inputs.redeploy_svg_generator || inputs.redeploy_all }} | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ secrets.CLOUD_SERVER_IP }} | |
username: ${{ secrets.CLOUD_SERVER_USER }} | |
key: ${{ secrets.CLOUD_SERVER_SSH_KEY }} | |
script: | | |
cd /root/ukraine_alarm_map/deploy/ | |
git fetch --all | |
git switch ${{ github.ref_name }} | |
git pull | |
bash redeploy_svg_generator.sh -m ${{ secrets.CLOUD_MEMCACHED_HOST }} | |
- name: Redeploy Etryvoga | |
if: ${{ inputs.redeploy_etryvoga || inputs.redeploy_all }} | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ secrets.CLOUD_SERVER_IP }} | |
username: ${{ secrets.CLOUD_SERVER_USER }} | |
key: ${{ secrets.CLOUD_SERVER_SSH_KEY }} | |
script: | | |
cd /root/ukraine_alarm_map/deploy/ | |
git fetch --all | |
git switch ${{ github.ref_name }} | |
git pull | |
bash redeploy_etryvoga.sh -e ${{ secrets.ETRYVOGA_HOST }} -ed ${{ secrets.ETRYVOGA_DISTRICTS_HOST }} -m ${{ secrets.CLOUD_MEMCACHED_HOST }} | |
- name: Redeploy Alerts | |
if: ${{ inputs.redeploy_alerts || inputs.redeploy_all }} | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ secrets.CLOUD_SERVER_IP }} | |
username: ${{ secrets.CLOUD_SERVER_USER }} | |
key: ${{ secrets.CLOUD_SERVER_SSH_KEY }} | |
script: | | |
cd /root/ukraine_alarm_map/deploy/ | |
git fetch --all | |
git switch ${{ github.ref_name }} | |
git pull | |
bash redeploy_alerts.sh -a ${{ secrets.AIR_ALARM_API_KEY }} -p 2 -m ${{ secrets.CLOUD_MEMCACHED_HOST }} | |
- name: Clear unused images | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ secrets.CLOUD_SERVER_IP }} | |
username: ${{ secrets.CLOUD_SERVER_USER }} | |
key: ${{ secrets.CLOUD_SERVER_SSH_KEY }} | |
script: | | |
docker image prune -f |