Merge pull request #1225 from PrestaShopCorp/release/v8.3.6.3 #59
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Module checkout CD Production Beta | |
on: | |
push: | |
tags: | |
- '*' | |
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 | |
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_PRODUCTION }} | |
service_account_key: ${{ secrets.G_CREDENTIAL_PRODUCTION }} | |
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_PRODUCTION }} | |
- name: Build module | |
run: | | |
composer install | |
cd _dev | |
yarn | |
- name: Delete old module | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST_PRODUCTION }} | |
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_PRODUCTION }} | |
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_PRODUCTION }} | |
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_PRODUCTION }} | |
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_PRODUCTION }} | |
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' |