Skip to content

adhoc - Update Stage #4

adhoc - Update Stage

adhoc - Update Stage #4

name: adhoc - Update Stage
# This is used to test changes to the deployment script before they are pushed to prod.
on:
workflow_dispatch:
inputs:
action:
description: 'Desired action against env'
required: true
default: 'update'
type: choice
options:
- update
- revert
deployment_description:
description: "A brief description of what changed in this deployment"
required: false
default: 'Stage Update/Revert via Github Action'
type: string
jobs:
config:
name: Config
runs-on: ubuntu-latest
outputs:
get-server-ip-list: ${{ steps.get-server-ip-list.outputs.get-server-ip-list }}
steps:
- id: get-server-ip-list
name: Get Server IP List
run: echo "get-server-ip-list=$(dig +short app-servers.pathology.gg TXT | jq -cr 'split(",")')" >> $GITHUB_OUTPUT
- name: print output
run: |
echo "${{ steps.get-server-ip-list.outputs.get-server-ip-list }}"
deploy-new-containers:
name: Update Stage
runs-on: ubuntu-latest
needs:
- config
strategy:
matrix:
server: ${{ fromJson(needs.config.outputs.get-server-ip-list) }}
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/pathology
chmod 600 ~/.ssh/pathology
cat >>~/.ssh/config <<END
Host *
User $SSH_USER
IdentityFile ~/.ssh/pathology
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.SERVER_SSH_USER }}
SSH_KEY: ${{ secrets.SERVER_SSH_KEY }}
- name: Update Environments with New Containers
run: ssh ${{ matrix.server }} 'bash /opt/pathology/scripts/update-Environments-test.sh -e stage -a ${{ inputs.action }} -c "${{ inputs.deployment_description }}"'