-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (51 loc) · 1.63 KB
/
deploy-application.yml
File metadata and controls
58 lines (51 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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
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@v4
with:
node-version: "20.x"
- name: Check site
uses: jtalk/url-health-check-action@v4
with:
url: ${{ vars.DESTINATION_URL }}