Skip to content

Commit 1046a39

Browse files
committed
Add Deployer-based deploy workflow
1 parent 4f8c750 commit 1046a39

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Deploy with Deployer
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
ENVIRONMENT:
7+
description: Name of the target environment to load Deployer settings.
8+
type: string
9+
required: true
10+
HOSTNAME:
11+
description: Name of the target host.
12+
type: string
13+
required: true
14+
PORT:
15+
description: SSH port on the target host.
16+
type: string
17+
required: true
18+
USERNAME:
19+
description: SSH user on the target host.
20+
type: string
21+
required: true
22+
VERBOSITY:
23+
description: Deployer command verbosity.
24+
required: true
25+
type: choice
26+
default: 'v'
27+
options:
28+
- 'v'
29+
- 'vv'
30+
- 'vvv'
31+
- 'vvvv'
32+
- 'q'
33+
PHP_VERSION:
34+
description: PHP version with which the scripts are executed.
35+
default: '8.2'
36+
required: false
37+
type: string
38+
secrets:
39+
COMPOSER_AUTH_JSON:
40+
description: Authentication for privately hosted packages and repositories as a JSON formatted object.
41+
required: false
42+
GITHUB_USER_SSH_KEY:
43+
description: Private SSH key to be used to reach remote destinations.
44+
required: false
45+
jobs:
46+
deploy:
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v4
52+
with:
53+
fetch-depth: 0
54+
ssh-key: ${{ secrets.GITHUB_USER_SSH_KEY }}
55+
56+
- name: Set up SSH
57+
uses: webfactory/ssh-agent@v0.9.1
58+
with:
59+
ssh-private-key: ${{ secrets.GITHUB_USER_SSH_KEY }}
60+
61+
- name: Setup PHP
62+
uses: shivammathur/setup-php@v2
63+
with:
64+
php-version: ${{ inputs.PHP_VERSION }}
65+
tools: composer
66+
coverage: none
67+
68+
- name: Install Website
69+
uses: ramsey/composer-install@v3
70+
env:
71+
COMPOSER_AUTH: '${{ secrets.COMPOSER_AUTH_JSON }}'
72+
with:
73+
composer-options: --no-dev --optimize-autoloader --no-interaction
74+
75+
- name: Install Deployer
76+
uses: ramsey/composer-install@v3
77+
with:
78+
working-directory: ./deployment
79+
composer-options: --no-dev --optimize-autoloader --no-interaction
80+
81+
- name: Run Deployer
82+
env:
83+
DEPLOY_HOSTNAME: ${{ inputs.HOSTNAME }}
84+
DEPLOY_PORT: ${{ inputs.PORT }}
85+
DEPLOY_USER: ${{ inputs.USERNAME }}
86+
run: |
87+
cd deployment
88+
./vendor/bin/dep deploy ${{ inputs.ENVIRONMENT }} -${{ inputs.VERBOSITY}}

0 commit comments

Comments
 (0)