Skip to content

Deploy

Deploy #182

Workflow file for this run

name: Deploy
concurrency:
group: deploy
on:
workflow_dispatch:
inputs:
ci_required:
description: "CI Suite is required"
type: boolean
required: true
default: true
perform_deploy_main:
description: "Deploy Paradise Main/Secondary"
type: boolean
required: true
default: true
perform_deploy_vega:
description: "Deploy Paradise Vega"
type: boolean
required: true
default: true
perform_deploy_cleo:
description: "Deploy Paradise Cleo"
type: boolean
required: true
default: true
perform_deploy_prime:
description: "Deploy Paradise Prime"
type: boolean
required: true
default: true
perform_deploy_wl:
description: "Deploy Paradise WL"
type: boolean
required: true
default: true
perform_deploy_tutorial:
description: "Deploy Paradise Tutorial"
type: boolean
required: true
default: true
jobs:
CI:
uses: ./.github/workflows/ci.yml # use the callable tests job to run tests
if: ${{ inputs.ci_required }}
update-isp-lists:
name: Update ISP Lists
runs-on: ubuntu-latest
steps:
- name: Update ISP Lists
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
passphrase: ${{ secrets.PRODUCTION_SSH_KEY_PASS }}
script: /var/lib/byond/update_isp_lists.sh
deploy:
name: Deploy Paradise
runs-on: ubuntu-latest
permissions:
deployments: write
strategy:
fail-fast: false
matrix:
environment: [Main, Vega, Cleo, Prime, WL, Tutorial]
environment: ${{ matrix.environment }}
needs: [update-isp-lists, CI]
if: always() && !cancelled() && !failure()
steps:
- name: Early exit
if: |
(matrix.environment == 'Main' && !inputs.perform_deploy_main) ||
(matrix.environment == 'Vega' && !inputs.perform_deploy_vega) ||
(matrix.environment == 'Cleo' && !inputs.perform_deploy_cleo) ||
(matrix.environment == 'Prime' && !inputs.perform_deploy_prime) ||
(matrix.environment == 'WL' && !inputs.perform_deploy_wl) ||
(matrix.environment == 'Tutorial' && !inputs.perform_deploy_tutorial)
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: chrnorm/deployment-action@v2
name: Create GitHub deployment
id: deployment
with:
token: "${{ github.token }}"
environment: ${{ matrix.environment }}
description: ${{ vars.ENVIRONMENT_URL }}
ref: ${{ vars.BRANCH }}
- name: Update and Build Paradise Main/Secondary
if: matrix.environment == 'Main' && inputs.perform_deploy_main
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
passphrase: ${{ secrets.PRODUCTION_SSH_KEY_PASS }}
script: |
TIME=$(date +'%Y-%m-%d%T')
sudo systemctl --wait start deploy-main
journalctl --since $TIME -u deploy-main --no-pager --all
systemctl is-failed deploy-main | grep -q "failed" && echo "Deployment Failed!" && exit 1 || exit 0
- name: Update and Build Paradise Vega
if: matrix.environment == 'Vega' && inputs.perform_deploy_vega
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
passphrase: ${{ secrets.PRODUCTION_SSH_KEY_PASS }}
script: |
TIME=$(date +'%Y-%m-%d%T')
sudo systemctl --wait start deploy-vega
journalctl --since $TIME -u deploy-vega --no-pager --all
systemctl is-failed deploy-vega | grep -q "failed" && echo "Deployment Failed!" && exit 1 || exit 0
- name: Update and Build Paradise Cleo
if: matrix.environment == 'Cleo' && inputs.perform_deploy_cleo
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
passphrase: ${{ secrets.PRODUCTION_SSH_KEY_PASS }}
script: |
TIME=$(date +'%Y-%m-%d%T')
sudo systemctl --wait start deploy-cleo
journalctl --since $TIME -u deploy-cleo --no-pager --all
systemctl is-failed deploy-cleo | grep -q "failed" && echo "Deployment Failed!" && exit 1 || exit 0
- name: Update and Build Paradise Prime
if: matrix.environment == 'Prime' && inputs.perform_deploy_prime
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
passphrase: ${{ secrets.PRODUCTION_SSH_KEY_PASS }}
script: |
TIME=$(date +'%Y-%m-%d%T')
sudo systemctl --wait start deploy-prime
journalctl --since $TIME -u deploy-prime --no-pager --all
systemctl is-failed deploy-prime | grep -q "failed" && echo "Deployment Failed!" && exit 1 || exit 0
- name: Update and Build Paradise WL
if: matrix.environment == 'WL' && inputs.perform_deploy_wl
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
passphrase: ${{ secrets.PRODUCTION_SSH_KEY_PASS }}
script: |
TIME=$(date +'%Y-%m-%d%T')
sudo systemctl --wait start deploy-wl
journalctl --since $TIME -u deploy-wl --no-pager --all
systemctl is-failed deploy-wl | grep -q "failed" && echo "Deployment Failed!" && exit 1 || exit 0
- name: Update and Build Paradise Tutorial
if: matrix.environment == 'Tutorial' && inputs.perform_deploy_tutorial
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
passphrase: ${{ secrets.PRODUCTION_SSH_KEY_PASS }}
script: |
TIME=$(date +'%Y-%m-%d%T')
sudo systemctl --wait start deploy-tutorial
journalctl --since $TIME -u deploy-tutorial --no-pager --all
systemctl is-failed deploy-tutorial | grep -q "failed" && echo "Deployment Failed!" && exit 1 || exit 0
- name: Update deployment status (success)
if: |
success()
uses: chrnorm/deployment-status@v2
with:
token: "${{ github.token }}"
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
state: "success"
- name: Update deployment status (failure)
if: |
failure()
uses: chrnorm/deployment-status@v2
with:
token: "${{ github.token }}"
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
state: "failure"