Skip to content

Merge pull request #781 from PrestaShopCorp/feat/perf-improvment #5545

Merge pull request #781 from PrestaShopCorp/feat/perf-improvment

Merge pull request #781 from PrestaShopCorp/feat/perf-improvment #5545

Workflow file for this run

name: Build & Release
on:
pull_request:
types: [opened, reopened]
release:
types: [released, prereleased]
push:
branches-ignore:
- feat/*
- fix/*
env:
LABELS: ${{toJSON(github.event.pull_request.labels)}}
jobs:
deploy:
name: build dependencies & create artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: 'actions/checkout@v4'
with:
path: ''
- name: Install composer dependencies
run: composer install --no-dev -o
- name: Clean-up project
uses: 'PrestaShopCorp/[email protected]'
- name: Cache module folder
uses: 'actions/cache@v4'
with:
path: ./
key: ${{ github.run_id }}
upload_asset_preproduction:
runs-on: ubuntu-latest
needs: [deploy]
permissions:
contents: 'read'
id-token: 'write'
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- name: Retrieve from cache module folder
id: retrieve-cache
uses: 'actions/cache@v4'
with:
path: ./
key: ${{ github.run_id }}
- name: Check if retrieved from cache was successful
if: steps.retrieve-cache.outputs.cache-hit != 'true'
run: exit 1
- name: Auth GCP
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.WI_PROVIDER_PREPRODUCTION }}
service_account: ${{ secrets.WI_SA_PREPRODUCTION }}
project_id: ${{ env.GCP_PROJECT }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.GCP_PROJECT }}
- name: Copy env files
run: |
gcloud secrets versions access latest --project $GCP_PROJECT --secret=mbo-module-env > .env
rm -f .env.dist
- name: Remove test settings files
run: |
rm -f gha-*.json
- name: Prepare the zip
run: |
cd ..
zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
- name: Create & upload artifact for preprod
uses: 'actions/upload-artifact@v4'
with:
name: ${{ github.event.repository.name }}.preprod
path: /home/runner/work/ps_mbo/${{ github.event.repository.name }}.zip
upload_release_asset_production:
name: Upload the production zip asset to the release
runs-on: ubuntu-latest
permissions:
contents: 'write'
id-token: 'write'
if: github.event_name == 'release'
needs: deploy
steps:
- name: Retrieve from cache module folder
id: retrieve-cache
uses: 'actions/cache@v4'
with:
path: ./
key: ${{ github.run_id }}
- name: Check if retrieved from cache was successful
if: steps.retrieve-cache.outputs.cache-hit != 'true'
run: exit 1
- name: Auth GCP
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.WI_PROVIDER_PRODUCTION }}
service_account: ${{ secrets.WI_SA_PRODUCTION }}
project_id: ${{ env.GCP_PROJECT }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.GCP_PROJECT }}
- name: Copy env files
run: |
rm -f .env.dist
gcloud secrets versions access latest --project $GCP_PROJECT --secret=mbo-module-env > .env
- name: Remove test settings files
run: |
rm -f gha-*.json
rm -f ./src/Traits/HaveConfigurationPage.php
sed -i '/HaveConfigurationPage/d' ps_mbo.php
- name: Prepare the production zip
run: |
cd ..
zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
- name: Publish the production zip
uses: softprops/action-gh-release@v1
with:
files: ../${{ github.event.repository.name }}.zip