Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASI-4532 Add Magento github workflow to deploy to dev environment #218

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/deploy_to_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy Magento2 Plugin to ADS Dev environment # http://ec2-100-25-3-18.compute-1.amazonaws.com

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Clear target directory on EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
rm -rf /home/ubuntu/github-workflow/*

- name: Copy plugin to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
source: "."
target: "/home/ubuntu/github-workflow" # temp location on ec2

- name: SSH commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
cd /var/www/magento2

# Uninstall old plugin
php bin/magento module:disable Bread_BreadCheckout --clear-static-content
rm -rf app/code/Bread/Bread_BreadCheckout/*

# Copy new plugin files
cp -R /home/ubuntu/github-workflow app/code/Bread/Bread_BreadCheckout

# Install new plugin
php bin/magento module:enable Bread_BreadCheckout --clear-static-content
php bin/magento setup:upgrade
php -dmemory_limit=2G bin/magento setup:di:compile
php bin/magento cache:flush