-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (61 loc) · 2.29 KB
/
Copy pathdeploy-application.yml
File metadata and controls
68 lines (61 loc) · 2.29 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
59
60
61
62
63
64
65
66
67
68
# 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@0ff4204d59e8e51228ff73bce53f80d53301dee2 # v1.2.5
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.DESTINATION_SSH_PRIVATE_KEY }}
script: |
set -euo pipefail
# Non-interactive SSH does not load ~/.bashrc; nvm lives there.
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
if [ -s "$NVM_DIR/nvm.sh" ]; then
. "$NVM_DIR/nvm.sh"
fi
cd ${{ secrets.SSH_PATH }}
git stash -m "Stashed by ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}"
git pull
composer install --no-dev --optimize-autoloader
cd web/app/plugins/cbf-multisite
npm ci && npm run build:assets
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@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- name: Check site
uses: jtalk/url-health-check-action@e7d5ebdc9027fbf494d2d034f3e8fc78f8b7a2b9
with:
url: ${{ vars.DESTINATION_URL }}