Skip to content

Deploy application #209

Deploy application

Deploy application #209

# This workflow deploys the application to a specified environment
name: Deploy application
# Controls when the action will run. Triggers the workflow on release publish events
on:
workflow_dispatch:
inputs:
destinationEnvironment:
description: "The target environment"
required: true
type: choice
options:
- "staging"
- "production"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Set target environment
environment:
name: "${{ inputs.destinationEnvironment }}"
steps:
# Deploys specific branch/commit to target environment
- name: Deploy to target
uses: appleboy/ssh-action@v1.2.5
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.DESTINATION_SSH_PRIVATE_KEY }}
script: |
cd ${{ secrets.SSH_PATH }}
git pull
check:
needs: [deploy]
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Set target environment
environment:
name: "${{ inputs.destinationEnvironment }}"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Sets the Node version
- name: Setup Node.js
uses: actions/setup-node@v6.3.0
with:
node-version: 24
- name: Check site
uses: jtalk/url-health-check-action@e7d5ebdc9027fbf494d2d034f3e8fc78f8b7a2b9
with:
url: ${{ vars.DESTINATION_URL }}