Skip to content

[SPIKE] Prestashop1.7 feature port #4396

[SPIKE] Prestashop1.7 feature port

[SPIKE] Prestashop1.7 feature port #4396

name: Module checkout CD
on:
pull_request:
types: [opened,edited,reopened,synchronize]
env:
MODULE_NAME: ps_checkout
GCLOUD_TOKEN_PATH: ./token.json
jobs:
checkout_cd:
name: Module Checkout continuous deployment
runs-on: ubuntu-latest
timeout-minutes: 5
if: contains(github.event.pull_request.labels.*.name, 'quality insurance needed')
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCLOUD_PROJECT_INTEGRATION }}
service_account_key: ${{ secrets.G_CREDENTIAL_INTEGRATION }}
export_default_credentials: true
- name: Copy env files
run: |
gcloud components install beta
gcloud beta secrets versions access latest --secret="checkout-module" > .env
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.G_CREDENTIAL_INTEGRATION }}
- name: Build module
run: |
composer install
cd _dev
yarn
- name: Delete old module
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST_INTEGRATION }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: sudo su -c 'docker exec $(docker ps -qf "name=${{ secrets.CONTAINER_NAME }}") rm -rf modules/${{ env.MODULE_NAME }}'
- name: Copy module
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST_INTEGRATION }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
source: "."
target: ${{ env.MODULE_NAME }}
- name: Move module
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST_INTEGRATION }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
sudo su -c 'mv ${{ env.MODULE_NAME }} ${{ secrets.MODULE_PATH }}'
sudo su -c 'chown -R www-data:www-data ${{ secrets.MODULE_PATH }}/${{ env.MODULE_NAME }}'
- name: Install module
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST_INTEGRATION }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
sudo su -c 'docker exec $(docker ps -qf "name=${{ secrets.CONTAINER_NAME }}") bin/console prestashop:module install ${{ env.MODULE_NAME }}'
- name: Clear cache
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST_INTEGRATION }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
sudo su -c 'docker exec $(docker ps -qf "name=${{ secrets.CONTAINER_NAME }}") bin/console cache:cl'
sudo su -c 'docker exec $(docker ps -qf "name=${{ secrets.CONTAINER_NAME }}") chmod -R 777 var/cache var/logs'