From dc50823790f73e6c4f49e4e0f6d83e6ca6981bc5 Mon Sep 17 00:00:00 2001 From: Paul Mucur Date: Wed, 15 Nov 2023 13:44:39 +0000 Subject: [PATCH] Deploy to primary and secondary web servers --- .github/actions/deploy-action/action.yml | 18 +++++++++++++----- .github/workflows/build.yml | 3 ++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/actions/deploy-action/action.yml b/.github/actions/deploy-action/action.yml index 6b2e578f17..ac777a7daf 100644 --- a/.github/actions/deploy-action/action.yml +++ b/.github/actions/deploy-action/action.yml @@ -1,5 +1,5 @@ name: Deploy via Bastion Host -description: "Deploy specified files and directories to a server via a bastion host" +description: "Deploy specified files and directories to a primary and secondary server via a bastion host" inputs: private_ssh_key: description: "The private SSH key used to authenticate with the remote servers" @@ -13,8 +13,12 @@ inputs: description: "The [user@]hostname of the bastion server" required: true - host: - description: "The [user@]hostname of the web server" + primary_host: + description: "The [user@]hostname of the primary web server" + required: true + + secondary_host: + description: "The [user@]hostname of the secondary web server" required: true source: @@ -45,6 +49,10 @@ runs: chmod 600 ~/.ssh/known_hosts shell: bash - - name: rsync source to destination - run: rsync -avz --delete -e 'ssh -A ${{ inputs.bastion_host }} ssh' ${{ inputs.source }} ${{ inputs.host }}:${{ inputs.destination }} + - name: Deploy to primary server + run: rsync -avz --delete -e 'ssh -A ${{ inputs.bastion_host }} ssh' ${{ inputs.source }} ${{ inputs.primary_host }}:${{ inputs.destination }} + shell: bash + + - name: Deploy to secondary server + run: rsync -avz --delete -e 'ssh -A ${{ inputs.bastion_host }} ssh' ${{ inputs.source }} ${{ inputs.secondary_host }}:${{ inputs.destination }} shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe2d4fbe1a..323adee518 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,8 @@ jobs: private_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }} public_bastion_host_keys: ${{ secrets.DEPLOY_KNOWN_HOSTS }} bastion_host: ${{ secrets.DEPLOY_BASTION_HOST }} - host: ${{ secrets.DEPLOY_HOST }} + primary_host: ${{ secrets.DEPLOY_PRIMARY_HOST }} + secondary_host: ${{ secrets.DEPLOY_SECONDARY_HOST }} # this needs to match destination: in _config.yml source: documentation/html/ destination: documentation