-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathaction.yml
92 lines (81 loc) · 3.33 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
name: 'Install and Start DDEV'
description: 'Installs the latest or specified version of DDEV and starts the project'
inputs:
ssh-private-key:
description: "SSH Private Key"
required: false
ssh-known-hosts:
description: "SSH Known Hosts"
required: false
git-email:
description: "Git e-mail address"
required: false
git-name:
description: "Git name"
required: false
composer-cache-dir:
description: "Composer cache directory, relative to the project workspace. Set to false to disable."
required: false
version:
description: "Override the DDEV version .e.g. '1.19.0'"
required: false
runs:
using: "composite"
steps:
- name: Install and Start DDEV
run: |
curl https://apt.fury.io/drud/gpg.key | sudo apt-key add -
echo "deb https://apt.fury.io/drud/ * *" | sudo tee -a /etc/apt/sources.list.d/ddev.list
sudo apt update
sudo apt install libnss3-tools -y
mkdir -p .ddev/homeadditions/.ssh
# Copy private key
if [ "${{ inputs.ssh-private-key }}" != "" ]; then
echo "${{ inputs.ssh-private-key }}" > .ddev/homeadditions/.ssh/id_rsa
chmod 600 .ddev/homeadditions/.ssh/id_rsa
fi
# Copy known hosts
if [ "${{ inputs.ssh-known-hosts }}" != "" ]; then
echo "${{ inputs.ssh-known-hosts}}" > .ddev/homeadditions/.ssh/known_hosts
chmod 644 .ddev/homeadditions/.ssh/known_hosts
fi
# SSH config file
touch .ddev/homeadditions/.ssh/config
# Disable strict host key checking for Pantheon as ssh-keyscan will not
# return a stable response.
if [ -f "pantheon.yml" ]; then
echo -e "Host *.drush.in\\n\\tStrictHostKeyChecking no\\n\tLogLevel ERROR\\n" >> .ddev/homeadditions/.ssh/config
fi
chmod 600 .ddev/homeadditions/.ssh/config
chmod 700 .ddev/homeadditions/.ssh
# Download and run the DDEV installer
if [ "${{ inputs.version }}" != "" ]; then
sudo apt install -y ddev=${{inputs.version}}
else
sudo apt install -y ddev
fi
# Support local runner https://github.com/nektos/act
if [ "$ACT" != "" ]; then
sudo chown runner:docker /var/run/docker.sock
fi
ddev config global --instrumentation-opt-in=false --omit-containers=ddev-ssh-agent
if [ "${{ inputs.composer-cache-dir }}" != "false" ]; then
# @todo Replace /var/www/html with an environment variable.
CACHE_DIR=".ddev/.drainpipe-composer-cache"
if [ "${{ inputs.composer-cache-dir }}" != "" ]; then
CACHE_DIR="${{ inputs.composer-cache-dir }}"
fi
# Workaround for https://github.com/ddev/ddev/issues/6044
if yq -re .type .ddev/config.yaml; then
ddev config --web-environment-add="COMPOSER_CACHE_DIR=/var/www/html/$CACHE_DIR" --project-type="$(yq -re .type .ddev/config.yaml)"
else
ddev config --web-environment-add="COMPOSER_CACHE_DIR=/var/www/html/$CACHE_DIR"
fi
fi
ddev start
ddev describe
# Copy git credentials
ddev exec "git config --global user.name \"${{ inputs.git-name }}\""
ddev exec "git config --global user.email \"${{ inputs.git-email }}\""
echo "DRAINPIPE_DDEV=true" >> $GITHUB_ENV
shell: bash