Deployment #36
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: Deployment | |
on: | |
workflow_dispatch: | |
inputs: | |
origin_run_id: | |
description: The ID of the workflow that triggered this workflow | |
required: true | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Download client artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: client | |
run-id: ${{ inputs.origin_run_id }} | |
github-token: ${{ secrets.PAT }} | |
path: .artifacts/client | |
- name: Download server artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: server | |
run-id: ${{ inputs.origin_run_id }} | |
github-token: ${{ secrets.PAT }} | |
path: .artifacts/server | |
- name: Output workspace | |
run: ls -a | |
- name: Setup Private Key | |
run: | | |
echo "${{secrets.DEPLOYMENT_PK}}" > temp_key | |
chmod 600 temp_key | |
# Server Deployment Start | |
- name: Deploy server artifact to production server | |
run: | | |
scp -o StrictHostKeyChecking=no -i temp_key -r .artifacts/server [email protected]:/data/stacks/shooter-io | |
- name: Deploy server docker compose file to production server | |
run: | | |
scp -o StrictHostKeyChecking=no -i temp_key -r server/docker-compose.server.yaml [email protected]:/data/stacks/shooter-io | |
- name: Restart Server Docker Service | |
run: | | |
ssh -o StrictHostKeyChecking=no -i temp_key [email protected] "cd /data/stacks/shooter-io && docker compose -f docker-compose.server.yaml down && docker compose -f docker-compose.server.yaml up -d" | |
# Server Deployment End | |
# Client Deployment Start | |
- name: Deploy client artifact to production server | |
run: | | |
scp -o StrictHostKeyChecking=no -i temp_key -r .artifacts/client [email protected]:/data/stacks/shooter-io | |
- name: Deploy client docker compose file to production server | |
run: | | |
scp -o StrictHostKeyChecking=no -i temp_key -r client/docker-compose.client.yaml [email protected]:/data/stacks/shooter-io | |
- name: Restart Client Docker Service | |
run: | | |
ssh -o StrictHostKeyChecking=no -i temp_key [email protected] "cd /data/stacks/shooter-io && docker compose -f docker-compose.client.yaml down && docker compose -f docker-compose.client.yaml up -d" | |
# Client Deployment End | |
- name: Clean up temp files | |
run: rm temp_key |