-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
110 lines (109 loc) · 4.42 KB
/
action.yml
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: 'Deploy Silverstripe'
description: 'Deploy a Github repository containing a Silverstripe project using Ansible'
inputs:
# -----------------------------
# Required inputs
# -----------------------------
host:
description: 'The hostname or IP of the target host'
required: true
host_user:
description: 'The user on the host which is used to deploy'
required: true
private_key:
description: 'The private key with which to authenticate'
required: true
working_dir:
description: 'The base directory where all files are stored. Note: this is NOT the webroot!'
required: true
base_url:
description: 'The url on which the page will listen (the SS_BASE_URL)'
required: true
admin_username:
description: 'The username of the default admin'
required: true
admin_password:
description: 'The password of the default admin'
required: true
database_name:
description: 'The name of the database to use'
required: true
database_username:
description: 'The username used to access the database'
required: true
database_password:
description: 'The password used to access the database'
required: true
# -----------------------------
# Optional inputs
# -----------------------------
current_dir:
description: The name of the webroot.
default: html
database_class:
description: 'The database class used by silverstripe'
default: MySQLPDODatabase
database_server:
description: 'The database server'
default: localhost
environment_type:
description: 'The environment type to be set. Defaults to live'
default: 'live'
htaccess_template:
description: 'Render a custom htaccess file. Uses the default if not specified, relative to the workspace'
default: 'htaccess.public.j2'
project_repository:
default: git@github.com:${{ github.repository }}.git
description: Manually set an origin repository. useful for using a host-specific ssh-config on the server with a deploy key.
composer_command:
description: Manually set the composer command
error_log:
description: 'The path to the error log'
default: '../../../logs/ss_log.log'
# retained_releases:
# description: 'How many releases should be retained. useful if you need to rollback to an old release quickly.'
# default: 4
# provisioning_commands:
# add_env_keys:
runs:
using: composite
steps:
# - name: Get the version / ref to deploy
# id: get_version
# shell: bash
# run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: move the playbook to the workspace
shell: bash
run: cp -R ${{ github.action_path }}/playbook ${{ github.workspace }}/.action-deploy-silverstripe-temp
- name: Deploy to desired server
uses: arillso/action.playbook@master
with:
user: ${{ inputs.host_user }}
playbook: .action-deploy-silverstripe-temp/playbook.yml
inventory: .action-deploy-silverstripe-temp/hosts
galaxy_file: .action-deploy-silverstripe-temp/requirements.yml
private_key: ${{ inputs.private_key }}
# extra_vars:
env:
ACTIONENV_WORKING_DIR: ${{ inputs.working_dir }}
ACTIONENV_SS_BASE_URL: ${{ inputs.base_url }}
ACTIONENV_SS_ADMIN_USERNAME: ${{ inputs.admin_username }}
ACTIONENV_SS_ADMIN_PASSWORD: ${{ inputs.admin_password }}
ACTIONENV_SS_DATABASE_SERVER: ${{ inputs.database_server }}
ACTIONENV_SS_DATABASE_NAME: ${{ inputs.database_name }}
ACTIONENV_SS_DATABASE_CLASS: ${{ inputs.database_class }}
ACTIONENV_SS_DATABASE_USERNAME: ${{ inputs.database_username }}
ACTIONENV_SS_DATABASE_PASSWORD: ${{ inputs.database_password }}
ACTIONENV_HTACCESS_TEMPLATE: ${{ github.workspace }}/${{ inputs.htaccess_template }}
ACTIONENV_ENVIRONMENT_TYPE: ${{ inputs.environment_type }}
ACTIONENV_ANSIBLE_HOST: ${{ inputs.host }}
ACTIONENV_ANSIBLE_USER: ${{ inputs.host_user }}
ACTIONENV_PROJECT_REPOSITORY: ${{ inputs.project_repository }}
ACTIONENV_PROJECT_VERSION: ${{ github.ref_name }}
ACTIONENV_CURRENT_DIR: ${{ inputs.current_dir }}
ACTIONENV_COMPOSER_COMMAND: ${{ inputs.composer_command }}
ACTIONENV_SS_ERROR_LOG: ${{ inputs.error_log }}
# ACTIONENV_RETAIN_RELEASES: ${{ inputs.retained_releases }}
ANSIBLE_HOST_KEY_CHECKING: 'false'
ANSIBLE_DEPRECATION_WARNINGS: 'false'
ANSIBLE_PIPELINING: 'true'