-
Notifications
You must be signed in to change notification settings - Fork 3
49 lines (45 loc) · 1.66 KB
/
deploy-to-dev.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
name: Deployment
on: [push, pull_request]
jobs:
build:
name: "Build"
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: php-actions/composer@v6
with:
php_version: "7.4"
php_extensions: gd
# test:
# ...
deploy:
name: "Deploy to DEV"
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
# needs: test
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/staging.key
chmod 600 ~/.ssh/staging.key
cat >>~/.ssh/config <<END
Host dev
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/staging.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.DEV_SSH_USER }}
SSH_KEY: ${{ secrets.DEV_SSH_KEY }}
SSH_HOST: ${{ secrets.DEV_SSH_HOST }}
- name: Check out the source
run: ssh dev 'cd /home4/kingpara/www/dev.drupal.am && git fetch && git reset --hard origin/master'
- name: Composer install
run: ssh dev 'cd /home4/kingpara/www/dev.drupal.am && /opt/cpanel/composer/bin/composer install -n'
- name: Updb, config sync and clear cache
run: ssh dev 'cd /home4/kingpara/www/dev.drupal.am && /home4/kingpara/public_html/dev.drupal.am/vendor/bin/drush updb -y && /home4/kingpara/public_html/dev.drupal.am/vendor/bin/drush cim -y && /home4/kingpara/public_html/dev.drupal.am/vendor/bin/drush cr'
#- name: Start the server
# if: ${{ always() }}
# run: ssh staging 'sudo systemctl start my-application'