Deploy Microservices from 'google_cloud' branch #44
This file contains hidden or 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_web_server: | |
type: boolean | |
default: false | |
description: Web server | |
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.GOOGLE_CLOUD_IP }} | |
username: ${{ secrets.GOOGLE_CLOUD_SSH_USER }} | |
key: ${{ secrets.GOOGLE_PRIVATE_SSH }} | |
script: | | |
cd esp32_grid_detector/deploy/ | |
git fetch --all | |
git switch ${{ github.ref_name }} | |
git pull | |
bash redeploy_websocket_server.sh -m ${{ secrets.MEMCACHED_HOST }} -u ${{ secrets.ENDPOINT_URL }} -e PROD | |
- name: Redeploy Web Server | |
if: ${{ inputs.redeploy_web_server || inputs.redeploy_all }} | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ secrets.GOOGLE_CLOUD_IP }} | |
username: ${{ secrets.GOOGLE_CLOUD_SSH_USER }} | |
key: ${{ secrets.GOOGLE_PRIVATE_SSH }} | |
script: | | |
cd esp32_grid_detector/deploy/ | |
git fetch --all | |
git switch ${{ github.ref_name }} | |
git pull | |
bash redeploy_web_server.sh -d ${{ secrets.WEB_TOKEN }} -m ${{ secrets.MEMCACHED_HOST }} | |
- name: Clear unused images | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ secrets.GOOGLE_CLOUD_IP }} | |
username: ${{ secrets.GOOGLE_CLOUD_SSH_USER }} | |
key: ${{ secrets.GOOGLE_PRIVATE_SSH }} | |
script: | | |
docker image prune -f |