From 030e7e7fe16bd85de104f7cbde33fef46a4fd3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Tue, 7 May 2024 17:38:15 +0200 Subject: [PATCH 01/35] GitHub workflow PS8 --- .github/workflows/build-release.yml | 93 ----------- .github/workflows/js.yml | 1 + .github/workflows/php.yml | 21 ++- .github/workflows/ps8-build-release.yml | 200 ++++++++++++++++++++++++ 4 files changed, 216 insertions(+), 99 deletions(-) delete mode 100644 .github/workflows/build-release.yml create mode 100644 .github/workflows/ps8-build-release.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml deleted file mode 100644 index 37bf5ee14..000000000 --- a/.github/workflows/build-release.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Build & Release draft - -on: - push: - branches: - - 'master' - - 'prestashop/8.x' - pull_request: - types: [ opened, reopened, synchronize, edited ] - -env: - GCLOUD_TOKEN_PATH: ./token.json - -jobs: - deploy: - name: build dependencies & create artifact - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2.0.0 - - - name: Gcloud auth and write env file - run: | - echo $GOOGLE_APPLICATION_CREDENTIALS > $GCLOUD_TOKEN_PATH - gcloud auth activate-service-account --key-file=$GCLOUD_TOKEN_PATH - gcloud container clusters get-credentials $GCLOUD_CLUSTER \ - --zone europe-west1-c --project $GCLOUD_PROJECT - gcloud beta secrets versions access latest --project=$GCLOUD_PROJECT --secret="checkout-module" > .env - rm $GCLOUD_TOKEN_PATH - env: - GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GCLOUD_CREDENTIAL_PRODUCTION }} - GCLOUD_TOKEN_PATH: ${{ env.GCLOUD_TOKEN_PATH }} - GCLOUD_CLUSTER: ${{ secrets.GCLOUD_CLUSTER }} - GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT_PRODUCTION }} - - - name: Build JS dependencies - uses: PrestaShopCorp/github-action-build-js/12@v1.0 - with: - cmd: npm - path: ./ - - - name: Install composer dependencies - run: composer install --no-dev -o - - - name: Clean-up project - uses: PrestaShopCorp/github-action-clean-before-deploy@v1.0 - - - name: Clean-up node_modules directory - run: sudo rm -rf node_modules - - - name: Create & upload artifact - uses: actions/upload-artifact@v1 - - with: - name: ${{ github.event.repository.name }} - path: ../ - update_release_draft: - runs-on: ubuntu-latest - needs: [deploy] - if: github.event_name == 'push' - steps: - - name: Download artifact - uses: actions/download-artifact@v1 - with: - name: ${{ github.event.repository.name }} - - id: release_info - uses: toolmantim/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Prepare for Release - run: | - cd ${{ github.event.repository.name }} - zip -r ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip ${{ github.event.repository.name }} -x '*.git*' - - name: Clean existing assets - shell: bash - run: | - curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 - assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'` - for asset in $assets - do - bin/hub api -X DELETE $asset - done - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Publish to GitHub Release - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.release_info.outputs.upload_url }} - asset_path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip - asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip - asset_content_type: application/zip diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index 5ee41112c..baa866a4b 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -4,6 +4,7 @@ jobs: js-linter: name: JS linter runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'ready to review') steps: - name: Checkout uses: actions/checkout@v2.0.0 diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 8e90cf09e..4e7d80dca 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -2,8 +2,8 @@ name: PHP tests on: push: branches: - - 'master' - - 'prestashop/8.x' + - "master" + - "prestashop/8.x" pull_request: types: [opened, reopened, synchronize, edited] @@ -11,6 +11,7 @@ jobs: header-stamp: name: Check license headers runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'ready to review') steps: - name: Checkout uses: actions/checkout@v2 @@ -18,7 +19,7 @@ jobs: - name: Setup PHP 7.4 uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: "7.4" - name: Cache vendor folder uses: actions/cache@v1 @@ -36,9 +37,11 @@ jobs: - name: Run Header Stamp in Dry Run mode run: php vendor/bin/header-stamp --license=vendor/prestashop/header-stamp/assets/afl.txt --exclude=.github,node_modules,vendor,tests,_dev --dry-run + php-linter: name: PHP Syntax check 7.2|7.3|7.4 runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'ready to review') steps: - name: Checkout uses: actions/checkout@v2.0.0 @@ -48,20 +51,24 @@ jobs: uses: prestashop/github-action-php-lint/7.3@master - name: PHP syntax checker 7.4 uses: prestashop/github-action-php-lint/7.4@master + php-cs-fixer: name: PHP-CS-Fixer runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'ready to review') steps: - name: Checkout uses: actions/checkout@v2.0.0 - name: Run PHP-CS-Fixer uses: prestashopcorp/github-action-php-cs-fixer@master + phpstan: name: PHPStan runs-on: ubuntu-latest strategy: matrix: - presta-versions: ['8.0.0', 'latest'] + presta-versions: ["8.0.0", "latest"] + if: contains(github.event.pull_request.labels.*.name, 'ready to review') steps: - name: Checkout uses: actions/checkout@v2.0.0 @@ -83,11 +90,13 @@ jobs: - name: Pull PrestaShop files (Tag ${{ matrix.presta-versions }}) run: docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:${{ matrix.presta-versions }} - - name : Run PHPStan + - name: Run PHPStan run: docker run --rm --volumes-from temp-ps -v $PWD:/web/module -e _PS_ROOT_DIR_=/var/www/html --workdir=/web/module phpstan/phpstan:0.12 analyse --configuration=/web/module/tests/phpstan/phpstan-PS-8.neon --error-format github + phpunit: name: PHPUnit runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'ready to review') steps: - name: Checkout uses: actions/checkout@v2 @@ -95,7 +104,7 @@ jobs: - name: Setup PHP 7.4 uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: "7.4" - name: Cache vendor folder uses: actions/cache@v1 diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml new file mode 100644 index 000000000..50522e972 --- /dev/null +++ b/.github/workflows/ps8-build-release.yml @@ -0,0 +1,200 @@ +name: PrestaShop 8 - Build & Release draft + +on: + pull_request: + types: [opened, reopened, synchronize, edited, labeled] + push: + tags: + - "v8.*" + branches: + - "prestashop/8.x" + +env: + ZIP_NAME_INTEGRATION: ${{ github.event.repository.name }}-integration-pr${{ github.event.number }} + ZIP_NAME_PREPRODUCTION: ${{ github.event.repository.name }}-preproduction-pr${{ github.event.number }} + ZIP_NAME_PRODUCTION: ${{ github.event.repository.name }}-${{ github.ref_name }} + +jobs: + deploy_integration: + name: INTEGRATION - Build dependencies & create artifact + runs-on: ubuntu-latest + if: + contains(github.event.pull_request.labels.*.name, 'integration deployment') && + contains(github.event.pull_request.labels.*.name, 'ps8') + + steps: + - name: Checkout the repository 🎁 + uses: actions/checkout@v4 + + - name: Auth GCP + uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 + with: + auth-mode: "workload-federation" + provider: ${{ secrets.WI_PROVIDER_INTEGRATION }} + service-account: ${{ secrets.WI_SA_INTEGRATION }} + registry-login: true + + - name: Write .env file + run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env + env: + GCP_PROJECT: ${{ secrets.GCP_PROJECT_INTEGRATION }} + + - name: Build JS dependencies + uses: PrestaShopCorp/github-action-build-js/12@v1.0 + with: + cmd: npm + path: ./ + + - name: Install composer dependencies + run: composer install --no-dev -o + + - name: Clean-up project + uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 + + - name: Clean-up node_modules directory + run: sudo rm -rf node_modules + + - name: Generate zip + run: | + cd ${{ github.event.repository.name }} + zip -r ${{ env.ZIP_NAME_INTEGRATION }}.zip ${{ github.event.repository.name }} -x '*.git*' + + - name: Push to GCP bucket storage + shell: bash + run: gsutil cp ${{ env.ZIP_NAME_INTEGRATION }}.zip gs://checkout-assets-integration/zips + + deploy_preproduction: + name: PREPRODUCTION - Build dependencies & create artifact + runs-on: ubuntu-latest + if: + contains(github.event.pull_request.labels.*.name, 'preproduction deployment') && + contains(github.event.pull_request.labels.*.name, 'ps8') + + steps: + - name: Checkout the repository 🎁 + uses: actions/checkout@v4 + + - name: Auth GCP + uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 + with: + auth-mode: "workload-federation" + provider: ${{ secrets.WI_PROVIDER_PREPRODUCTION }} + service-account: ${{ secrets.WI_SA_PREPRODUCTION }} + registry-login: true + + - name: Write .env file + run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env + env: + GCP_PROJECT: ${{ secrets.GCP_PROJECT_PREPRODUCTION }} + + - name: Build JS dependencies + uses: PrestaShopCorp/github-action-build-js/12@v1.0 + with: + cmd: npm + path: ./ + + - name: Install composer dependencies + run: composer install --no-dev -o + + - name: Clean-up project + uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 + + - name: Clean-up node_modules directory + run: sudo rm -rf node_modules + + - name: Generate zip + run: | + cd ${{ github.event.repository.name }} + zip -r ${{ env.ZIP_NAME_PREPRODUCTION }}.zip ${{ github.event.repository.name }} -x '*.git*' + + - name: Push to GCP bucket storage + shell: bash + run: gsutil cp ${{ env.ZIP_NAME_PREPRODUCTION }}.zip gs://checkout-assets-preproduction/zips + + deploy_production: + name: PRODUCTION - Build dependencies & create artifact + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository 🎁 + uses: actions/checkout@v4 + + - name: Auth GCP + uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 + with: + auth-mode: "workload-federation" + provider: ${{ secrets.WI_PROVIDER_PRODUCTION }} + service-account: ${{ secrets.WI_SA_PRODUCTION }} + registry-login: true + + - name: Write .env file + run: | + gcloud beta secrets versions access latest --project=$GCLOUD_PROJECT --secret="module-env" > .env + env: + GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT_PRODUCTION }} + + - name: Build JS dependencies + uses: PrestaShopCorp/github-action-build-js/12@v1.0 + with: + cmd: npm + path: ./ + + - name: Install composer dependencies + run: composer install --no-dev -o + + - name: Clean-up project + uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 + + - name: Clean-up node_modules directory + run: sudo rm -rf node_modules + + - name: Create & upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.ZIP_NAME_PRODUCTION }} + path: ../ + + update_release_draft_production: + name: PRODUCTION - Update release draft + runs-on: ubuntu-latest + needs: [deploy_production] + if: github.event_name == 'push' + + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: ${{ env.ZIP_NAME_PRODUCTION }} + + - name: Release drafter + id: release_info + uses: toolmantim/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Prepare for Release + run: | + cd ${{ github.event.repository.name }} + zip -r ${{ env.ZIP_NAME_PRODUCTION }}.zip ${{ github.event.repository.name }} -x '*.git*' + + - name: Clean existing assets + shell: bash + run: | + curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 + assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'` + for asset in $assets + do + bin/hub api -X DELETE $asset + done + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish to GitHub Release + uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.release_info.outputs.upload_url }} + asset_path: ./${{ github.event.repository.name }}/${{ env.ZIP_NAME_PRODUCTION }}.zip + asset_name: ${{ env.ZIP_NAME_PRODUCTION }}.zip + asset_content_type: application/zip From 3bd26e2982d9b34715ac8769cdcf24193224b336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Tue, 7 May 2024 17:46:24 +0200 Subject: [PATCH 02/35] Trigger production workflow only with new release --- .github/workflows/ps8-build-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 50522e972..b34cfe3a7 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -114,6 +114,7 @@ jobs: deploy_production: name: PRODUCTION - Build dependencies & create artifact runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags') steps: - name: Checkout the repository 🎁 From 6e514ea753ef6dec9b8a1b451097a77f69da2b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Tue, 4 Jun 2024 17:51:07 +0200 Subject: [PATCH 03/35] Adapt secrets and buckets storage --- .github/workflows/ps8-build-release.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index b34cfe3a7..af6943be4 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -30,8 +30,8 @@ jobs: uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 with: auth-mode: "workload-federation" - provider: ${{ secrets.WI_PROVIDER_INTEGRATION }} - service-account: ${{ secrets.WI_SA_INTEGRATION }} + provider: ${{ secrets.WI_PROVIDER_V2_INTEGRATION }} + service-account: ${{ secrets.WI_SA_V2_INTEGRATION }} registry-login: true - name: Write .env file @@ -61,7 +61,7 @@ jobs: - name: Push to GCP bucket storage shell: bash - run: gsutil cp ${{ env.ZIP_NAME_INTEGRATION }}.zip gs://checkout-assets-integration/zips + run: gsutil cp ${{ env.ZIP_NAME_INTEGRATION }}.zip gs://ps-eu-w1-checkout-assets-integration/zips deploy_preproduction: name: PREPRODUCTION - Build dependencies & create artifact @@ -78,8 +78,8 @@ jobs: uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 with: auth-mode: "workload-federation" - provider: ${{ secrets.WI_PROVIDER_PREPRODUCTION }} - service-account: ${{ secrets.WI_SA_PREPRODUCTION }} + provider: ${{ secrets.WI_PROVIDER_V2_PREPRODUCTION }} + service-account: ${{ secrets.WI_SA_V2_PREPRODUCTION }} registry-login: true - name: Write .env file @@ -109,7 +109,7 @@ jobs: - name: Push to GCP bucket storage shell: bash - run: gsutil cp ${{ env.ZIP_NAME_PREPRODUCTION }}.zip gs://checkout-assets-preproduction/zips + run: gsutil cp ${{ env.ZIP_NAME_PREPRODUCTION }}.zip gs://ps-eu-w1-checkout-assets-preproduction/zips deploy_production: name: PRODUCTION - Build dependencies & create artifact @@ -124,8 +124,8 @@ jobs: uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 with: auth-mode: "workload-federation" - provider: ${{ secrets.WI_PROVIDER_PRODUCTION }} - service-account: ${{ secrets.WI_SA_PRODUCTION }} + provider: ${{ secrets.WI_PROVIDER_V2_PRODUCTION }} + service-account: ${{ secrets.WI_SA_V2_PRODUCTION }} registry-login: true - name: Write .env file From 5ca2d35709628bffe8aeb35167f35553e183acda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Wed, 5 Jun 2024 11:28:25 +0200 Subject: [PATCH 04/35] Add permissions --- .github/workflows/ps8-build-release.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index af6943be4..229a468d1 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -18,6 +18,10 @@ jobs: deploy_integration: name: INTEGRATION - Build dependencies & create artifact runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + pull-requests: write if: contains(github.event.pull_request.labels.*.name, 'integration deployment') && contains(github.event.pull_request.labels.*.name, 'ps8') @@ -66,6 +70,10 @@ jobs: deploy_preproduction: name: PREPRODUCTION - Build dependencies & create artifact runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + pull-requests: write if: contains(github.event.pull_request.labels.*.name, 'preproduction deployment') && contains(github.event.pull_request.labels.*.name, 'ps8') @@ -114,6 +122,10 @@ jobs: deploy_production: name: PRODUCTION - Build dependencies & create artifact runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + pull-requests: write if: startsWith(github.ref, 'refs/tags') steps: @@ -158,6 +170,10 @@ jobs: update_release_draft_production: name: PRODUCTION - Update release draft runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + pull-requests: write needs: [deploy_production] if: github.event_name == 'push' From 28e5c90ce3cc42aad889d1a645403d49ca7936a8 Mon Sep 17 00:00:00 2001 From: Maxence Perrin Date: Wed, 5 Jun 2024 14:25:14 +0200 Subject: [PATCH 05/35] devops: comments jobs --- .github/workflows/ps8-build-release.yml | 296 ++++++++++++------------ 1 file changed, 148 insertions(+), 148 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 229a468d1..2c266324b 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -67,151 +67,151 @@ jobs: shell: bash run: gsutil cp ${{ env.ZIP_NAME_INTEGRATION }}.zip gs://ps-eu-w1-checkout-assets-integration/zips - deploy_preproduction: - name: PREPRODUCTION - Build dependencies & create artifact - runs-on: ubuntu-latest - permissions: - id-token: write - contents: read - pull-requests: write - if: - contains(github.event.pull_request.labels.*.name, 'preproduction deployment') && - contains(github.event.pull_request.labels.*.name, 'ps8') - - steps: - - name: Checkout the repository 🎁 - uses: actions/checkout@v4 - - - name: Auth GCP - uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 - with: - auth-mode: "workload-federation" - provider: ${{ secrets.WI_PROVIDER_V2_PREPRODUCTION }} - service-account: ${{ secrets.WI_SA_V2_PREPRODUCTION }} - registry-login: true - - - name: Write .env file - run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env - env: - GCP_PROJECT: ${{ secrets.GCP_PROJECT_PREPRODUCTION }} - - - name: Build JS dependencies - uses: PrestaShopCorp/github-action-build-js/12@v1.0 - with: - cmd: npm - path: ./ - - - name: Install composer dependencies - run: composer install --no-dev -o - - - name: Clean-up project - uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 - - - name: Clean-up node_modules directory - run: sudo rm -rf node_modules - - - name: Generate zip - run: | - cd ${{ github.event.repository.name }} - zip -r ${{ env.ZIP_NAME_PREPRODUCTION }}.zip ${{ github.event.repository.name }} -x '*.git*' - - - name: Push to GCP bucket storage - shell: bash - run: gsutil cp ${{ env.ZIP_NAME_PREPRODUCTION }}.zip gs://ps-eu-w1-checkout-assets-preproduction/zips - - deploy_production: - name: PRODUCTION - Build dependencies & create artifact - runs-on: ubuntu-latest - permissions: - id-token: write - contents: read - pull-requests: write - if: startsWith(github.ref, 'refs/tags') - - steps: - - name: Checkout the repository 🎁 - uses: actions/checkout@v4 - - - name: Auth GCP - uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 - with: - auth-mode: "workload-federation" - provider: ${{ secrets.WI_PROVIDER_V2_PRODUCTION }} - service-account: ${{ secrets.WI_SA_V2_PRODUCTION }} - registry-login: true - - - name: Write .env file - run: | - gcloud beta secrets versions access latest --project=$GCLOUD_PROJECT --secret="module-env" > .env - env: - GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT_PRODUCTION }} - - - name: Build JS dependencies - uses: PrestaShopCorp/github-action-build-js/12@v1.0 - with: - cmd: npm - path: ./ - - - name: Install composer dependencies - run: composer install --no-dev -o - - - name: Clean-up project - uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 - - - name: Clean-up node_modules directory - run: sudo rm -rf node_modules - - - name: Create & upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ env.ZIP_NAME_PRODUCTION }} - path: ../ - - update_release_draft_production: - name: PRODUCTION - Update release draft - runs-on: ubuntu-latest - permissions: - id-token: write - contents: read - pull-requests: write - needs: [deploy_production] - if: github.event_name == 'push' - - steps: - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: ${{ env.ZIP_NAME_PRODUCTION }} - - - name: Release drafter - id: release_info - uses: toolmantim/release-drafter@v6 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Prepare for Release - run: | - cd ${{ github.event.repository.name }} - zip -r ${{ env.ZIP_NAME_PRODUCTION }}.zip ${{ github.event.repository.name }} -x '*.git*' - - - name: Clean existing assets - shell: bash - run: | - curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 - assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'` - for asset in $assets - do - bin/hub api -X DELETE $asset - done - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish to GitHub Release - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.release_info.outputs.upload_url }} - asset_path: ./${{ github.event.repository.name }}/${{ env.ZIP_NAME_PRODUCTION }}.zip - asset_name: ${{ env.ZIP_NAME_PRODUCTION }}.zip - asset_content_type: application/zip +# deploy_preproduction: +# name: PREPRODUCTION - Build dependencies & create artifact +# runs-on: ubuntu-latest +# permissions: +# id-token: write +# contents: read +# pull-requests: write +# if: +# contains(github.event.pull_request.labels.*.name, 'preproduction deployment') && +# contains(github.event.pull_request.labels.*.name, 'ps8') +# +# steps: +# - name: Checkout the repository 🎁 +# uses: actions/checkout@v4 +# +# - name: Auth GCP +# uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 +# with: +# auth-mode: "workload-federation" +# provider: ${{ secrets.WI_PROVIDER_V2_PREPRODUCTION }} +# service-account: ${{ secrets.WI_SA_V2_PREPRODUCTION }} +# registry-login: true +# +# - name: Write .env file +# run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env +# env: +# GCP_PROJECT: ${{ secrets.GCP_PROJECT_PREPRODUCTION }} +# +# - name: Build JS dependencies +# uses: PrestaShopCorp/github-action-build-js/12@v1.0 +# with: +# cmd: npm +# path: ./ +# +# - name: Install composer dependencies +# run: composer install --no-dev -o +# +# - name: Clean-up project +# uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 +# +# - name: Clean-up node_modules directory +# run: sudo rm -rf node_modules +# +# - name: Generate zip +# run: | +# cd ${{ github.event.repository.name }} +# zip -r ${{ env.ZIP_NAME_PREPRODUCTION }}.zip ${{ github.event.repository.name }} -x '*.git*' +# +# - name: Push to GCP bucket storage +# shell: bash +# run: gsutil cp ${{ env.ZIP_NAME_PREPRODUCTION }}.zip gs://ps-eu-w1-checkout-assets-preproduction/zips +# +# deploy_production: +# name: PRODUCTION - Build dependencies & create artifact +# runs-on: ubuntu-latest +# permissions: +# id-token: write +# contents: read +# pull-requests: write +# if: startsWith(github.ref, 'refs/tags') +# +# steps: +# - name: Checkout the repository 🎁 +# uses: actions/checkout@v4 +# +# - name: Auth GCP +# uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 +# with: +# auth-mode: "workload-federation" +# provider: ${{ secrets.WI_PROVIDER_V2_PRODUCTION }} +# service-account: ${{ secrets.WI_SA_V2_PRODUCTION }} +# registry-login: true +# +# - name: Write .env file +# run: | +# gcloud beta secrets versions access latest --project=$GCLOUD_PROJECT --secret="module-env" > .env +# env: +# GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT_PRODUCTION }} +# +# - name: Build JS dependencies +# uses: PrestaShopCorp/github-action-build-js/12@v1.0 +# with: +# cmd: npm +# path: ./ +# +# - name: Install composer dependencies +# run: composer install --no-dev -o +# +# - name: Clean-up project +# uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 +# +# - name: Clean-up node_modules directory +# run: sudo rm -rf node_modules +# +# - name: Create & upload artifact +# uses: actions/upload-artifact@v4 +# with: +# name: ${{ env.ZIP_NAME_PRODUCTION }} +# path: ../ +# +# update_release_draft_production: +# name: PRODUCTION - Update release draft +# runs-on: ubuntu-latest +# permissions: +# id-token: write +# contents: read +# pull-requests: write +# needs: [deploy_production] +# if: github.event_name == 'push' +# +# steps: +# - name: Download artifact +# uses: actions/download-artifact@v4 +# with: +# name: ${{ env.ZIP_NAME_PRODUCTION }} +# +# - name: Release drafter +# id: release_info +# uses: toolmantim/release-drafter@v6 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# - name: Prepare for Release +# run: | +# cd ${{ github.event.repository.name }} +# zip -r ${{ env.ZIP_NAME_PRODUCTION }}.zip ${{ github.event.repository.name }} -x '*.git*' +# +# - name: Clean existing assets +# shell: bash +# run: | +# curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 +# assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'` +# for asset in $assets +# do +# bin/hub api -X DELETE $asset +# done +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# - name: Publish to GitHub Release +# uses: actions/upload-release-asset@v1.0.2 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# upload_url: ${{ steps.release_info.outputs.upload_url }} +# asset_path: ./${{ github.event.repository.name }}/${{ env.ZIP_NAME_PRODUCTION }}.zip +# asset_name: ${{ env.ZIP_NAME_PRODUCTION }}.zip +# asset_content_type: application/zip From ae909e525dba4b64c26e8ec3c2341a60a741d01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Thu, 6 Jun 2024 10:35:12 +0200 Subject: [PATCH 06/35] Add auth-gcp Github action --- .github/actions/auth-gcp/action.yml | 86 +++++++++++++++++++++++++ .github/workflows/ps8-build-release.yml | 7 +- 2 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 .github/actions/auth-gcp/action.yml diff --git a/.github/actions/auth-gcp/action.yml b/.github/actions/auth-gcp/action.yml new file mode 100644 index 000000000..74982c126 --- /dev/null +++ b/.github/actions/auth-gcp/action.yml @@ -0,0 +1,86 @@ +name: 'Auth GCP' +description: 'Auth gcp, can login to docker artifact registry or install the sdk' +inputs: + auth-mode: + description: 'Authentication mode (workload-federation or json-file)' + required: true + type: choice + options: + - workload-federation + - json-file + default: 'workload-federation' + registry-login: + required: false + type: bool + default: false + credentials-json: + required: false + type: string + setup-gcloud: + required: false + type: bool + default: false + service-account: + required: false + description: Service account email + type: string + provider: + required: false + description: gcp workload identity provider + type: string + gcp-registry-region: + required: false + description: docker registry gcp + default: "europe-west1-docker.pkg.dev" + type: string + sdk-version: + required: true + description: which version of google dsl you want to suer + default: '>=457.0.0' + type: string + gke-cluster-name: + required: false + description: 'If you put the cluster name in this variable it will activate auth to make kubectl' + default: '' + type: string + cluster-region: + required: false + description: 'Cluster region' + type: choice + options: + - europe-west1 + default: 'europe-west1' + +runs: + using: 'composite' + steps: + - name: Authenticate to Google Cloud with Workload Federation 🔐 + if: ${{ inputs.auth-mode == 'workload-federation' }} + uses: google-github-actions/auth@v2 + with: + workload_identity_provider: ${{ inputs.provider }} + service_account: ${{ inputs.service-account }} + + - name: Authenticate to Google Cloud with a JSON file 🔐 (THIS IS DEPRECATED ❌) + if: ${{ inputs.auth-mode == 'json-file' }} + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ inputs.credentials-json }} + + - name: Setting up gcloud SDK 🛠 + if: ${{ inputs.setup-gcloud == 'true' }} + uses: google-github-actions/setup-gcloud@v2 + with: + version: ${{ inputs.sdk-version }} + + - name: Login to Docker artifact registry 🐳 + if: ${{ inputs.registry-login == 'true' }} + shell: bash + run: gcloud auth configure-docker ${{ inputs.gcp-registry-region }} + + - name: Add cluster authentification 🧊 + if: ${{ inputs.gke-cluster-name != '' }} + uses: 'google-github-actions/get-gke-credentials@v2' + with: + cluster_name: '${{ inputs.gke-cluster-name }}' + location: '${{ inputs.cluster-region }}' diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 2c266324b..a961a8305 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -31,7 +31,7 @@ jobs: uses: actions/checkout@v4 - name: Auth GCP - uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 + uses: ./.github/actions/auth-gcp with: auth-mode: "workload-federation" provider: ${{ secrets.WI_PROVIDER_V2_INTEGRATION }} @@ -66,7 +66,6 @@ jobs: - name: Push to GCP bucket storage shell: bash run: gsutil cp ${{ env.ZIP_NAME_INTEGRATION }}.zip gs://ps-eu-w1-checkout-assets-integration/zips - # deploy_preproduction: # name: PREPRODUCTION - Build dependencies & create artifact # runs-on: ubuntu-latest @@ -83,7 +82,7 @@ jobs: # uses: actions/checkout@v4 # # - name: Auth GCP -# uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 +# uses: ./.github/actions/auth-gcp # with: # auth-mode: "workload-federation" # provider: ${{ secrets.WI_PROVIDER_V2_PREPRODUCTION }} @@ -133,7 +132,7 @@ jobs: # uses: actions/checkout@v4 # # - name: Auth GCP -# uses: PrestaShopCorp/prestashop-github-action-gcp-auth@v1 +# uses: ./.github/actions/auth-gcp # with: # auth-mode: "workload-federation" # provider: ${{ secrets.WI_PROVIDER_V2_PRODUCTION }} From f4c9a7c05ce9583be6696046a64ac30e509183e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Thu, 6 Jun 2024 10:49:25 +0200 Subject: [PATCH 07/35] Change actions/checkout version --- .github/workflows/ps8-build-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index a961a8305..2180794c7 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Checkout the repository 🎁 - uses: actions/checkout@v4 + uses: actions/checkout@v2 - name: Auth GCP uses: ./.github/actions/auth-gcp From 8ee7524ff77f11882cd8c1adadf3a79a047e7330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Thu, 6 Jun 2024 11:12:27 +0200 Subject: [PATCH 08/35] Change actions/checkout version --- .github/workflows/ps8-build-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 2180794c7..640b0115c 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Checkout the repository 🎁 - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Auth GCP uses: ./.github/actions/auth-gcp @@ -60,7 +60,6 @@ jobs: - name: Generate zip run: | - cd ${{ github.event.repository.name }} zip -r ${{ env.ZIP_NAME_INTEGRATION }}.zip ${{ github.event.repository.name }} -x '*.git*' - name: Push to GCP bucket storage From 52ddc33535d8a429fb73bb587e22fb7f8e04b968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Thu, 6 Jun 2024 11:40:05 +0200 Subject: [PATCH 09/35] Test --- .github/workflows/ps8-build-release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 640b0115c..071849754 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -56,10 +56,14 @@ jobs: uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 - name: Clean-up node_modules directory - run: sudo rm -rf node_modules + run: | + sudo rm -rf node_modules + ls -la - name: Generate zip run: | + ls -la + cd ${{ github.event.repository.name }} zip -r ${{ env.ZIP_NAME_INTEGRATION }}.zip ${{ github.event.repository.name }} -x '*.git*' - name: Push to GCP bucket storage From 8dc739c7cdaada177ca6431a6781140b984d25d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Thu, 6 Jun 2024 11:44:06 +0200 Subject: [PATCH 10/35] Fix zip generation --- .github/workflows/ps8-build-release.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 071849754..a02b53d61 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -58,13 +58,10 @@ jobs: - name: Clean-up node_modules directory run: | sudo rm -rf node_modules - ls -la - name: Generate zip run: | - ls -la - cd ${{ github.event.repository.name }} - zip -r ${{ env.ZIP_NAME_INTEGRATION }}.zip ${{ github.event.repository.name }} -x '*.git*' + zip -r ${{ env.ZIP_NAME_INTEGRATION }}.zip . -x '*.git*' - name: Push to GCP bucket storage shell: bash From 4b850e13577af2a2d6214012599b0523179bfdb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Thu, 6 Jun 2024 15:46:45 +0200 Subject: [PATCH 11/35] Fix push to bucket storage --- .github/workflows/ps8-build-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index a02b53d61..910f9a6e1 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -37,6 +37,7 @@ jobs: provider: ${{ secrets.WI_PROVIDER_V2_INTEGRATION }} service-account: ${{ secrets.WI_SA_V2_INTEGRATION }} registry-login: true + setup-gcloud: true - name: Write .env file run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env From 4c96371e35553b8529b108bb0ce0801b673e8fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Thu, 6 Jun 2024 16:59:10 +0200 Subject: [PATCH 12/35] Fix .env writting --- .github/workflows/ps8-build-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 910f9a6e1..f5b7d096e 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -40,7 +40,7 @@ jobs: setup-gcloud: true - name: Write .env file - run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env + run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" --quiet > .env env: GCP_PROJECT: ${{ secrets.GCP_PROJECT_INTEGRATION }} From 104f80abc90218fbe63ca789e9cd670433ea79b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Fri, 7 Jun 2024 09:50:12 +0200 Subject: [PATCH 13/35] Fix .env writting --- .github/workflows/ps8-build-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index f5b7d096e..f713b1af1 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -40,7 +40,7 @@ jobs: setup-gcloud: true - name: Write .env file - run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" --quiet > .env + run: gcloud --quiet beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env env: GCP_PROJECT: ${{ secrets.GCP_PROJECT_INTEGRATION }} From 20b5ee588b86b14fe681087f3c4ced5504f170a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 10 Jun 2024 12:09:22 +0200 Subject: [PATCH 14/35] Add date to zip name --- .github/workflows/ps8-build-release.yml | 23 ++++++++---- Makefile | 50 ------------------------- deploy.sh | 21 ----------- docker-compose.yml | 17 --------- 4 files changed, 16 insertions(+), 95 deletions(-) delete mode 100644 Makefile delete mode 100644 deploy.sh delete mode 100644 docker-compose.yml diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index f713b1af1..d4ee7c808 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -15,6 +15,15 @@ env: ZIP_NAME_PRODUCTION: ${{ github.event.repository.name }}-${{ github.ref_name }} jobs: + current_date: + runs-on: ubuntu-latest + outputs: + date: ${{ steps.date.outputs.date }} + + steps: + - id: date + run: echo "date=$(date +'%Y-%m-%d-%H-%M-%S')" >> "$GITHUB_OUTPUT" + deploy_integration: name: INTEGRATION - Build dependencies & create artifact runs-on: ubuntu-latest @@ -53,20 +62,20 @@ jobs: - name: Install composer dependencies run: composer install --no-dev -o - - name: Clean-up project - uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 + # - name: Clean-up project + # uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 - - name: Clean-up node_modules directory - run: | - sudo rm -rf node_modules + # - name: Clean-up node_modules directory + # run: | + # sudo rm -rf node_modules - name: Generate zip run: | - zip -r ${{ env.ZIP_NAME_INTEGRATION }}.zip . -x '*.git*' + zip -r ${{ env.ZIP_NAME_INTEGRATION }}-${{ needs.current_date.outputs.date }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev' -x 'tests' - name: Push to GCP bucket storage shell: bash - run: gsutil cp ${{ env.ZIP_NAME_INTEGRATION }}.zip gs://ps-eu-w1-checkout-assets-integration/zips + run: gsutil cp ${{ env.ZIP_NAME_INTEGRATION }}.zip gs://ps-eu-w1-checkout-assets-integration/zips/ps8 # deploy_preproduction: # name: PREPRODUCTION - Build dependencies & create artifact # runs-on: ubuntu-latest diff --git a/Makefile b/Makefile deleted file mode 100644 index 23e0ff4b5..000000000 --- a/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -help: - @egrep "^#" Makefile - -# target: docker-build|db - Setup/Build PHP & (node)JS dependencies -db: docker-build -docker-build: build-back build-front - -build-back: - docker-compose run --rm php sh -c "composer install" - -build-back-prod: - docker-compose run --rm php sh -c "composer install --no-dev -o" - -build-front: - docker-compose run --rm node sh -c "npm i --prefix ./_dev/js/front" - docker-compose run --rm node sh -c "npm run build --prefix ./_dev/js/front" - -# target: watch-front - Watcher for the vueJS files -watch-front: - docker-compose run --rm node sh -c "npm run watch --prefix ./_dev/js/front" - -# target: test-front - Launch the front test suite -test-front: - docker-compose run --rm node sh -c "npm test --prefix ./_dev/js/front" - -build-zip: - cp -Ra $(PWD) /tmp/ps_checkout - rm -rf /tmp/ps_checkout/.env.test - rm -rf /tmp/ps_checkout/.php_cs.* - rm -rf /tmp/ps_checkout/.travis.yml - rm -rf /tmp/ps_checkout/cloudbuild.yaml - rm -rf /tmp/ps_checkout/composer.* - rm -rf /tmp/ps_checkout/package.json - rm -rf /tmp/ps_checkout/.npmrc - rm -rf /tmp/ps_checkout/package-lock.json - rm -rf /tmp/ps_checkout/.gitignore - rm -rf /tmp/ps_checkout/deploy.sh - rm -rf /tmp/ps_checkout/.editorconfig - rm -rf /tmp/ps_checkout/.git - rm -rf /tmp/ps_checkout/.github - rm -rf /tmp/ps_checkout/_dev - rm -rf /tmp/ps_checkout/tests - rm -rf /tmp/ps_checkout/docker-compose.yml - rm -rf /tmp/ps_checkout/Makefile - mv -v /tmp/ps_checkout $(PWD)/ps_checkout - zip -r ps_checkout.zip ps_checkout - rm -rf $(PWD)/ps_checkout - -# target: build-zip-prod - Launch prod zip generation of the module (will not work on windows) -build-zip-prod: build-back-prod test-front build-front build-zip diff --git a/deploy.sh b/deploy.sh deleted file mode 100644 index f022a82e4..000000000 --- a/deploy.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -FILEPATH=$1 -ENV=$2 -SHOP=$3 - -gcloud container clusters get-credentials --project="prestashop-ready-$ENV" --zone="europe-west1-d" "prestashop-ready-cluster" - -function deploy() { - echo "** Deploy on : " $1 " ***" - kubectl cp /workspace/$FILEPATH $ENV-shops/$1:/ - kubectl exec -t --namespace=$ENV-shops $1 -- bash -c \ - " - sudo -u presthost -H bash -c \"mkdir -p /presthost/core/img/tmp &>/dev/null;\"; - sudo -u presthost -H bash -c \"unzip -o /$FILEPATH -d /presthost/userland/modules > /dev/null 2>&1;\"; - rm -f /${FILEPATH}; - sudo -u presthost --preserve-env -H bash -c '/presthost/core/bin/console prestashop:module install ps_checkout'; - " -} - -deploy $(kubectl get pods --namespace=$ENV-shops -l shop=dep-$SHOP -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 1533f54df..000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '3.7' - -services: - php: - image: phpdockerio/php72-cli - volumes: - - ./:/var/www/html/modules/ps_checkout - working_dir: /var/www/html/modules/ps_checkout - environment: - _PS_ROOT_DIR_: /var/www/html - node: - image: node:13.1 - volumes: - - ./:/var/www/html/modules/ps_checkout - working_dir: /var/www/html/modules/ps_checkout - environment: - PATH: /var/www/html/_dev/node_modules/.bin/:$PATH From 897974a662fa5d9d8252c62d8e0b158cf22bd0d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 10 Jun 2024 14:44:18 +0200 Subject: [PATCH 15/35] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e8991c05a..5692466b7 100755 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ ### Ignore integration settings ### .env .env.test +.env.* ### PrestaShop cache config_*.xml From 34a468a206da8df99dba957e2f77c3c13c3e7114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 10 Jun 2024 16:59:05 +0200 Subject: [PATCH 16/35] Fix CI --- .github/workflows/ps8-build-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index d4ee7c808..572d4deb3 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -27,6 +27,7 @@ jobs: deploy_integration: name: INTEGRATION - Build dependencies & create artifact runs-on: ubuntu-latest + needs: [current_date] permissions: id-token: write contents: read From 364f042c3b53a24033b080c15b7f902ae0028439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 10 Jun 2024 17:51:30 +0200 Subject: [PATCH 17/35] Fix CI --- .github/workflows/ps8-build-release.yml | 313 ++++++++++++------------ 1 file changed, 159 insertions(+), 154 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 572d4deb3..782a9a8fd 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -10,18 +10,18 @@ on: - "prestashop/8.x" env: - ZIP_NAME_INTEGRATION: ${{ github.event.repository.name }}-integration-pr${{ github.event.number }} - ZIP_NAME_PREPRODUCTION: ${{ github.event.repository.name }}-preproduction-pr${{ github.event.number }} - ZIP_NAME_PRODUCTION: ${{ github.event.repository.name }}-${{ github.ref_name }} + ZIP_NAME: ${{ github.event.repository.name }}-${{ github.ref_name }} jobs: current_date: + name: Get current date runs-on: ubuntu-latest outputs: date: ${{ steps.date.outputs.date }} steps: - - id: date + - name: Date + id: date run: echo "date=$(date +'%Y-%m-%d-%H-%M-%S')" >> "$GITHUB_OUTPUT" deploy_integration: @@ -35,6 +35,8 @@ jobs: if: contains(github.event.pull_request.labels.*.name, 'integration deployment') && contains(github.event.pull_request.labels.*.name, 'ps8') + env: + ZIP_NAME: ${{ github.event.repository.name }}-integration-pr${{ github.event.number }}-${{ needs.current_date.outputs.date }} steps: - name: Checkout the repository 🎁 @@ -72,156 +74,159 @@ jobs: - name: Generate zip run: | - zip -r ${{ env.ZIP_NAME_INTEGRATION }}-${{ needs.current_date.outputs.date }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev' -x 'tests' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev' -x 'tests' - name: Push to GCP bucket storage shell: bash - run: gsutil cp ${{ env.ZIP_NAME_INTEGRATION }}.zip gs://ps-eu-w1-checkout-assets-integration/zips/ps8 -# deploy_preproduction: -# name: PREPRODUCTION - Build dependencies & create artifact -# runs-on: ubuntu-latest -# permissions: -# id-token: write -# contents: read -# pull-requests: write -# if: -# contains(github.event.pull_request.labels.*.name, 'preproduction deployment') && -# contains(github.event.pull_request.labels.*.name, 'ps8') -# -# steps: -# - name: Checkout the repository 🎁 -# uses: actions/checkout@v4 -# -# - name: Auth GCP -# uses: ./.github/actions/auth-gcp -# with: -# auth-mode: "workload-federation" -# provider: ${{ secrets.WI_PROVIDER_V2_PREPRODUCTION }} -# service-account: ${{ secrets.WI_SA_V2_PREPRODUCTION }} -# registry-login: true -# -# - name: Write .env file -# run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env -# env: -# GCP_PROJECT: ${{ secrets.GCP_PROJECT_PREPRODUCTION }} -# -# - name: Build JS dependencies -# uses: PrestaShopCorp/github-action-build-js/12@v1.0 -# with: -# cmd: npm -# path: ./ -# -# - name: Install composer dependencies -# run: composer install --no-dev -o -# -# - name: Clean-up project -# uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 -# -# - name: Clean-up node_modules directory -# run: sudo rm -rf node_modules -# -# - name: Generate zip -# run: | -# cd ${{ github.event.repository.name }} -# zip -r ${{ env.ZIP_NAME_PREPRODUCTION }}.zip ${{ github.event.repository.name }} -x '*.git*' -# -# - name: Push to GCP bucket storage -# shell: bash -# run: gsutil cp ${{ env.ZIP_NAME_PREPRODUCTION }}.zip gs://ps-eu-w1-checkout-assets-preproduction/zips -# -# deploy_production: -# name: PRODUCTION - Build dependencies & create artifact -# runs-on: ubuntu-latest -# permissions: -# id-token: write -# contents: read -# pull-requests: write -# if: startsWith(github.ref, 'refs/tags') -# -# steps: -# - name: Checkout the repository 🎁 -# uses: actions/checkout@v4 -# -# - name: Auth GCP -# uses: ./.github/actions/auth-gcp -# with: -# auth-mode: "workload-federation" -# provider: ${{ secrets.WI_PROVIDER_V2_PRODUCTION }} -# service-account: ${{ secrets.WI_SA_V2_PRODUCTION }} -# registry-login: true -# -# - name: Write .env file -# run: | -# gcloud beta secrets versions access latest --project=$GCLOUD_PROJECT --secret="module-env" > .env -# env: -# GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT_PRODUCTION }} -# -# - name: Build JS dependencies -# uses: PrestaShopCorp/github-action-build-js/12@v1.0 -# with: -# cmd: npm -# path: ./ -# -# - name: Install composer dependencies -# run: composer install --no-dev -o -# -# - name: Clean-up project -# uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 -# -# - name: Clean-up node_modules directory -# run: sudo rm -rf node_modules -# -# - name: Create & upload artifact -# uses: actions/upload-artifact@v4 -# with: -# name: ${{ env.ZIP_NAME_PRODUCTION }} -# path: ../ -# -# update_release_draft_production: -# name: PRODUCTION - Update release draft -# runs-on: ubuntu-latest -# permissions: -# id-token: write -# contents: read -# pull-requests: write -# needs: [deploy_production] -# if: github.event_name == 'push' -# -# steps: -# - name: Download artifact -# uses: actions/download-artifact@v4 -# with: -# name: ${{ env.ZIP_NAME_PRODUCTION }} -# -# - name: Release drafter -# id: release_info -# uses: toolmantim/release-drafter@v6 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# -# - name: Prepare for Release -# run: | -# cd ${{ github.event.repository.name }} -# zip -r ${{ env.ZIP_NAME_PRODUCTION }}.zip ${{ github.event.repository.name }} -x '*.git*' -# -# - name: Clean existing assets -# shell: bash -# run: | -# curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 -# assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'` -# for asset in $assets -# do -# bin/hub api -X DELETE $asset -# done -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# -# - name: Publish to GitHub Release -# uses: actions/upload-release-asset@v1.0.2 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# with: -# upload_url: ${{ steps.release_info.outputs.upload_url }} -# asset_path: ./${{ github.event.repository.name }}/${{ env.ZIP_NAME_PRODUCTION }}.zip -# asset_name: ${{ env.ZIP_NAME_PRODUCTION }}.zip -# asset_content_type: application/zip + run: gsutil cp ${{ env.ZIP_NAME }}.zip gs://ps-eu-w1-checkout-assets-integration/zips/ps8 + + deploy_preproduction: + name: PREPRODUCTION - Build dependencies & create artifact + runs-on: ubuntu-latest + needs: [current_date] + permissions: + id-token: write + contents: read + pull-requests: write + if: + contains(github.event.pull_request.labels.*.name, 'preproduction deployment') && + contains(github.event.pull_request.labels.*.name, 'ps8') + env: + ZIP_NAME: ${{ github.event.repository.name }}-preproduction-pr${{ github.event.number }}-${{ needs.current_date.outputs.date }} + + steps: + - name: Checkout the repository 🎁 + uses: actions/checkout@v4 + + - name: Auth GCP + uses: ./.github/actions/auth-gcp + with: + auth-mode: "workload-federation" + provider: ${{ secrets.WI_PROVIDER_V2_PREPRODUCTION }} + service-account: ${{ secrets.WI_SA_V2_PREPRODUCTION }} + registry-login: true + + - name: Write .env file + run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env + env: + GCP_PROJECT: ${{ secrets.GCP_PROJECT_PREPRODUCTION }} + + - name: Build JS dependencies + uses: PrestaShopCorp/github-action-build-js/12@v1.0 + with: + cmd: npm + path: ./ + + - name: Install composer dependencies + run: composer install --no-dev -o + + # - name: Clean-up project + # uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 + + # - name: Clean-up node_modules directory + # run: sudo rm -rf node_modules + + - name: Generate zip + run: | + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev' -x 'tests' + + - name: Push to GCP bucket storage + shell: bash + run: gsutil cp ${{ env.ZIP_NAME }}.zip gs://ps-eu-w1-checkout-assets-preproduction/zips + + deploy_production: + name: PRODUCTION - Build dependencies & create artifact + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + pull-requests: write + if: startsWith(github.ref, 'refs/tags') + + steps: + - name: Checkout the repository 🎁 + uses: actions/checkout@v4 + + - name: Auth GCP + uses: ./.github/actions/auth-gcp + with: + auth-mode: "workload-federation" + provider: ${{ secrets.WI_PROVIDER_V2_PRODUCTION }} + service-account: ${{ secrets.WI_SA_V2_PRODUCTION }} + registry-login: true + + - name: Write .env file + run: | + gcloud beta secrets versions access latest --project=$GCLOUD_PROJECT --secret="module-env" > .env + env: + GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT_PRODUCTION }} + + - name: Build JS dependencies + uses: PrestaShopCorp/github-action-build-js/12@v1.0 + with: + cmd: npm + path: ./ + + - name: Install composer dependencies + run: composer install --no-dev -o + + - name: Clean-up project + uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 + + - name: Clean-up node_modules directory + run: sudo rm -rf node_modules + + - name: Create & upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.ZIP_NAME }} + path: ../ + + update_release_draft_production: + name: PRODUCTION - Update release draft + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + pull-requests: write + needs: [deploy_production] + if: github.event_name == 'push' + + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: ${{ env.ZIP_NAME }} + + - name: Release drafter + id: release_info + uses: toolmantim/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Prepare for Release + run: | + cd ${{ github.event.repository.name }} + zip -r ${{ env.ZIP_NAME }}.zip ${{ github.event.repository.name }} -x '*.git*' + + - name: Clean existing assets + shell: bash + run: | + curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 + assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'` + for asset in $assets + do + bin/hub api -X DELETE $asset + done + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish to GitHub Release + uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.release_info.outputs.upload_url }} + asset_path: ./${{ github.event.repository.name }}/${{ env.ZIP_NAME }}.zip + asset_name: ${{ env.ZIP_NAME }}.zip + asset_content_type: application/zip From 905181c80e00762c1ad0c92088bba6538671f877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Tue, 11 Jun 2024 09:28:08 +0200 Subject: [PATCH 18/35] Set date +2h on zip name --- .github/workflows/ps8-build-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 782a9a8fd..70a1094d5 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Date id: date - run: echo "date=$(date +'%Y-%m-%d-%H-%M-%S')" >> "$GITHUB_OUTPUT" + run: echo "date=$(date -d '+2 hours' +'%Y-%m-%d-%H-%M-%S')" >> "$GITHUB_OUTPUT" deploy_integration: name: INTEGRATION - Build dependencies & create artifact From 59467862a8bb04182d9190d5fedaf8e4f43ac8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Tue, 11 Jun 2024 11:56:32 +0200 Subject: [PATCH 19/35] Adapt production workflow --- .github/workflows/ps8-build-release.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 70a1094d5..b8b11d250 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -132,7 +132,7 @@ jobs: - name: Push to GCP bucket storage shell: bash - run: gsutil cp ${{ env.ZIP_NAME }}.zip gs://ps-eu-w1-checkout-assets-preproduction/zips + run: gsutil cp ${{ env.ZIP_NAME }}.zip gs://ps-eu-w1-checkout-assets-preproduction/zips/ps8 deploy_production: name: PRODUCTION - Build dependencies & create artifact @@ -170,17 +170,25 @@ jobs: - name: Install composer dependencies run: composer install --no-dev -o - - name: Clean-up project - uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 + # - name: Clean-up project + # uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 - - name: Clean-up node_modules directory - run: sudo rm -rf node_modules + # - name: Clean-up node_modules directory + # run: sudo rm -rf node_modules - name: Create & upload artifact uses: actions/upload-artifact@v4 with: name: ${{ env.ZIP_NAME }} - path: ../ + path: | + ../ + !../*.git* + !../.php_cs.* + !../**/node_modules + !../composer.* + !../.editorconfig + !../_dev + !../tests update_release_draft_production: name: PRODUCTION - Update release draft @@ -206,8 +214,7 @@ jobs: - name: Prepare for Release run: | - cd ${{ github.event.repository.name }} - zip -r ${{ env.ZIP_NAME }}.zip ${{ github.event.repository.name }} -x '*.git*' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev' -x 'tests' - name: Clean existing assets shell: bash From dcc6f65a175a6c8976e8075924bf107561b14ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Tue, 11 Jun 2024 12:07:29 +0200 Subject: [PATCH 20/35] Fix auth GCP action --- .github/workflows/ps8-build-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index b8b11d250..3ebd32a82 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -105,6 +105,7 @@ jobs: provider: ${{ secrets.WI_PROVIDER_V2_PREPRODUCTION }} service-account: ${{ secrets.WI_SA_V2_PREPRODUCTION }} registry-login: true + setup-gcloud: true - name: Write .env file run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env @@ -154,6 +155,7 @@ jobs: provider: ${{ secrets.WI_PROVIDER_V2_PRODUCTION }} service-account: ${{ secrets.WI_SA_V2_PRODUCTION }} registry-login: true + setup-gcloud: true - name: Write .env file run: | From 108a5ef0335e37cf4d570e1108ce1349bc0159d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Tue, 11 Jun 2024 12:10:18 +0200 Subject: [PATCH 21/35] Fix writting env file --- .github/workflows/ps8-build-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 3ebd32a82..0a2dc41aa 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -108,7 +108,7 @@ jobs: setup-gcloud: true - name: Write .env file - run: gcloud beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env + run: gcloud --quiet beta secrets versions access latest --project=$GCP_PROJECT --secret="module-env" > .env env: GCP_PROJECT: ${{ secrets.GCP_PROJECT_PREPRODUCTION }} @@ -159,7 +159,7 @@ jobs: - name: Write .env file run: | - gcloud beta secrets versions access latest --project=$GCLOUD_PROJECT --secret="module-env" > .env + gcloud --quiet beta secrets versions access latest --project=$GCLOUD_PROJECT --secret="module-env" > .env env: GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT_PRODUCTION }} From 18303939d3f72fdb4f3119d26dd667b56561dcb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Tue, 11 Jun 2024 14:37:09 +0200 Subject: [PATCH 22/35] Exclude folders _dev and tests for the zip generation --- .github/workflows/ps8-build-release.yml | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 0a2dc41aa..0dfe0ef79 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -65,16 +65,9 @@ jobs: - name: Install composer dependencies run: composer install --no-dev -o - # - name: Clean-up project - # uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 - - # - name: Clean-up node_modules directory - # run: | - # sudo rm -rf node_modules - - name: Generate zip run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev' -x 'tests' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*/_dev' -x '*/tests' - name: Push to GCP bucket storage shell: bash @@ -121,15 +114,9 @@ jobs: - name: Install composer dependencies run: composer install --no-dev -o - # - name: Clean-up project - # uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 - - # - name: Clean-up node_modules directory - # run: sudo rm -rf node_modules - - name: Generate zip run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev' -x 'tests' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*/_dev' -x '*/tests' - name: Push to GCP bucket storage shell: bash @@ -172,12 +159,6 @@ jobs: - name: Install composer dependencies run: composer install --no-dev -o - # - name: Clean-up project - # uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 - - # - name: Clean-up node_modules directory - # run: sudo rm -rf node_modules - - name: Create & upload artifact uses: actions/upload-artifact@v4 with: @@ -216,7 +197,7 @@ jobs: - name: Prepare for Release run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev' -x 'tests' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*/_dev' -x '*/tests' - name: Clean existing assets shell: bash From f99ec7c74d9a44bf1344304d67da7cbc89340b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Tue, 11 Jun 2024 14:49:51 +0200 Subject: [PATCH 23/35] Exclude folders _dev and tests for the zip generation --- .github/workflows/ps8-build-release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 0dfe0ef79..5e3d2495a 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Date id: date - run: echo "date=$(date -d '+2 hours' +'%Y-%m-%d-%H-%M-%S')" >> "$GITHUB_OUTPUT" + run: echo "date=$(date -d '+2 hours' +'%Y-%m-%d_%H-%M-%S')" >> "$GITHUB_OUTPUT" deploy_integration: name: INTEGRATION - Build dependencies & create artifact @@ -67,7 +67,7 @@ jobs: - name: Generate zip run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*/_dev' -x '*/tests' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev/**\*' -x 'tests/**\*' - name: Push to GCP bucket storage shell: bash @@ -116,7 +116,7 @@ jobs: - name: Generate zip run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*/_dev' -x '*/tests' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev/**\*' -x 'tests/**\*' - name: Push to GCP bucket storage shell: bash @@ -197,7 +197,7 @@ jobs: - name: Prepare for Release run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*/_dev' -x '*/tests' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev/**\*' -x 'tests/**\*' - name: Clean existing assets shell: bash From ac3deed6766152d35c3323e512c0fcc3912ba2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Tue, 11 Jun 2024 15:06:06 +0200 Subject: [PATCH 24/35] Exclude folders _dev and tests for the zip generation --- .github/workflows/ps8-build-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 5e3d2495a..f7384d119 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -67,7 +67,7 @@ jobs: - name: Generate zip run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev/**\*' -x 'tests/**\*' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*_dev*' -x '*tests*' - name: Push to GCP bucket storage shell: bash @@ -116,7 +116,7 @@ jobs: - name: Generate zip run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev/**\*' -x 'tests/**\*' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*_dev*' -x '*tests*' - name: Push to GCP bucket storage shell: bash @@ -197,7 +197,7 @@ jobs: - name: Prepare for Release run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '_dev/**\*' -x 'tests/**\*' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*_dev*' -x '*tests*' - name: Clean existing assets shell: bash From 919743df5d6a52d8c99ba177e1832516e843191f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Thu, 13 Jun 2024 11:01:15 +0200 Subject: [PATCH 25/35] Exclude package.* files from zip generation --- .github/workflows/ps8-build-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index f7384d119..a95bc87e0 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -67,7 +67,7 @@ jobs: - name: Generate zip run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*_dev*' -x '*tests*' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' - name: Push to GCP bucket storage shell: bash @@ -116,7 +116,7 @@ jobs: - name: Generate zip run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*_dev*' -x '*tests*' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' - name: Push to GCP bucket storage shell: bash @@ -197,7 +197,7 @@ jobs: - name: Prepare for Release run: | - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x '.editorconfig' -x '*_dev*' -x '*tests*' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' - name: Clean existing assets shell: bash From f011e9279593e2fe0302278da775591c93738f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Fri, 14 Jun 2024 10:32:04 +0200 Subject: [PATCH 26/35] Add ps8-clean-buckets workflow --- .github/workflows/ps8-build-release.yml | 8 ++------ .github/workflows/ps8-clean-buckets.yml | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ps8-clean-buckets.yml diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index a95bc87e0..1e4af8887 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -32,9 +32,7 @@ jobs: id-token: write contents: read pull-requests: write - if: - contains(github.event.pull_request.labels.*.name, 'integration deployment') && - contains(github.event.pull_request.labels.*.name, 'ps8') + if: contains(github.event.pull_request.labels.*.name, 'integration deployment') env: ZIP_NAME: ${{ github.event.repository.name }}-integration-pr${{ github.event.number }}-${{ needs.current_date.outputs.date }} @@ -81,9 +79,7 @@ jobs: id-token: write contents: read pull-requests: write - if: - contains(github.event.pull_request.labels.*.name, 'preproduction deployment') && - contains(github.event.pull_request.labels.*.name, 'ps8') + if: contains(github.event.pull_request.labels.*.name, 'preproduction deployment') env: ZIP_NAME: ${{ github.event.repository.name }}-preproduction-pr${{ github.event.number }}-${{ needs.current_date.outputs.date }} diff --git a/.github/workflows/ps8-clean-buckets.yml b/.github/workflows/ps8-clean-buckets.yml new file mode 100644 index 000000000..6a15123f1 --- /dev/null +++ b/.github/workflows/ps8-clean-buckets.yml @@ -0,0 +1,25 @@ +name: PrestaShop 8 - Clean zips from buckets after merged PR + +on: + pull_request: + types: [closed] + push: + branches: + - "prestashop/8.x" + +env: + ZIP_NAME: ${{ github.event.repository.name }}-${{ github.ref_name }} + +jobs: + remove_zips: + name: Remove zips related to closed PR + runs-on: ubuntu-latest + + steps: + - name: Remove outdated integration zips + shell: bash + run: gcloud storage rm gs://ps-eu-w1-checkout-assets-integration/zips/ps8/${{ github.event.repository.name }}-integration-pr${{ github.event.number }}* + + - name: Remove outdated preproduction zips + shell: bash + run: gcloud storage rm gs://ps-eu-w1-checkout-assets-preproduction/zips/ps8/${{ github.event.repository.name }}-preproduction-pr${{ github.event.number }}* From 43ed9a0144decbbdeffafabf3f2ce4a000f13a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Fri, 12 Jul 2024 18:09:13 +0200 Subject: [PATCH 27/35] Fix zip installation on PrestaShop --- .github/workflows/ps8-build-release.yml | 3 +++ lib | 1 + 2 files changed, 4 insertions(+) create mode 120000 lib diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 1e4af8887..96a80a43d 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -65,6 +65,7 @@ jobs: - name: Generate zip run: | + cd ${{ github.event.repository.name }} zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' - name: Push to GCP bucket storage @@ -112,6 +113,7 @@ jobs: - name: Generate zip run: | + cd ${{ github.event.repository.name }} zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' - name: Push to GCP bucket storage @@ -193,6 +195,7 @@ jobs: - name: Prepare for Release run: | + cd ${{ github.event.repository.name }} zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' - name: Clean existing assets diff --git a/lib b/lib new file mode 120000 index 000000000..a58fb2ddc --- /dev/null +++ b/lib @@ -0,0 +1 @@ +/app/lib \ No newline at end of file From 9e913ebd597c94b2b2753080560c82221e6a4d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 15 Jul 2024 14:32:39 +0200 Subject: [PATCH 28/35] Fix zip installation on PrestaShop --- .github/workflows/ps8-build-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 96a80a43d..2b7a730e8 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -65,7 +65,9 @@ jobs: - name: Generate zip run: | + mkdir -p ${{ github.event.repository.name }} cd ${{ github.event.repository.name }} + cp -R ../* . zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' - name: Push to GCP bucket storage From 4243a5abcf7c185db30bae8f9b05b5a7b5ff2f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 15 Jul 2024 14:36:47 +0200 Subject: [PATCH 29/35] Fix zip installation on PrestaShop --- .github/workflows/ps8-build-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 2b7a730e8..162ca584f 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -65,6 +65,7 @@ jobs: - name: Generate zip run: | + ls -la mkdir -p ${{ github.event.repository.name }} cd ${{ github.event.repository.name }} cp -R ../* . From f6d9f5a179d839335f14b3538ab2c3affb6bcf30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 15 Jul 2024 15:12:29 +0200 Subject: [PATCH 30/35] Fix zip installation on PrestaShop --- .github/workflows/ps8-build-release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 162ca584f..670c72f9f 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -66,10 +66,12 @@ jobs: - name: Generate zip run: | ls -la - mkdir -p ${{ github.event.repository.name }} + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' + unzip ${{ env.ZIP_NAME }}.zip -d ${{ github.event.repository.name }} cd ${{ github.event.repository.name }} - cp -R ../* . zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' + cd ../ + cp ${{ github.event.repository.name }}/${{ env.ZIP_NAME }}.zip . - name: Push to GCP bucket storage shell: bash From b7812961cbd03a4752294a2bb69bee328d745669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 15 Jul 2024 15:24:33 +0200 Subject: [PATCH 31/35] Fix zip installation on PrestaShop --- lib | 1 - 1 file changed, 1 deletion(-) delete mode 120000 lib diff --git a/lib b/lib deleted file mode 120000 index a58fb2ddc..000000000 --- a/lib +++ /dev/null @@ -1 +0,0 @@ -/app/lib \ No newline at end of file From 0fca0f1f3c08e7bc9ed06559cac2f72540171824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 15 Jul 2024 15:47:57 +0200 Subject: [PATCH 32/35] Fix zip installation on PrestaShop --- .github/workflows/ps8-build-release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 670c72f9f..ddad0fcb0 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -63,13 +63,14 @@ jobs: - name: Install composer dependencies run: composer install --no-dev -o + # It's mandatory to generate the zip inside a folder named ps_checkout, to make the zip installation working on PrestaShop - name: Generate zip run: | ls -la - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' unzip ${{ env.ZIP_NAME }}.zip -d ${{ github.event.repository.name }} cd ${{ github.event.repository.name }} - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' cd ../ cp ${{ github.event.repository.name }}/${{ env.ZIP_NAME }}.zip . From 5db55db080fc7e5f558f650d9568eb253982c7c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 15 Jul 2024 16:00:52 +0200 Subject: [PATCH 33/35] Fix zip installation on PrestaShop --- .github/workflows/ps8-build-release.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index ddad0fcb0..11bf25f07 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -67,12 +67,13 @@ jobs: - name: Generate zip run: | ls -la - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' - unzip ${{ env.ZIP_NAME }}.zip -d ${{ github.event.repository.name }} - cd ${{ github.event.repository.name }} - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' cd ../ - cp ${{ github.event.repository.name }}/${{ env.ZIP_NAME }}.zip . + zip -r ${{ env.ZIP_NAME }}.zip ${{ github.event.repository.name }} -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' + # unzip ${{ env.ZIP_NAME }}.zip -d ${{ github.event.repository.name }} + # cd ${{ github.event.repository.name }} + # zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' + # cd ../ + # cp ${{ github.event.repository.name }}/${{ env.ZIP_NAME }}.zip . - name: Push to GCP bucket storage shell: bash From 52691da357ac14866b1f80b24ddc147fb73122e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 15 Jul 2024 16:08:11 +0200 Subject: [PATCH 34/35] Fix zip installation on PrestaShop --- .github/workflows/ps8-build-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index 11bf25f07..d329f27ad 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -69,6 +69,7 @@ jobs: ls -la cd ../ zip -r ${{ env.ZIP_NAME }}.zip ${{ github.event.repository.name }} -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' + cp ${{ env.ZIP_NAME }}.zip ${{ github.event.repository.name }} # unzip ${{ env.ZIP_NAME }}.zip -d ${{ github.event.repository.name }} # cd ${{ github.event.repository.name }} # zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' From a27949599cd241a0cdc60398e65f5fba6a0f3346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BIDAULT?= Date: Mon, 15 Jul 2024 16:50:50 +0200 Subject: [PATCH 35/35] Fix zip installation on PrestaShop --- .github/workflows/ps8-build-release.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ps8-build-release.yml b/.github/workflows/ps8-build-release.yml index d329f27ad..366d4a24f 100644 --- a/.github/workflows/ps8-build-release.yml +++ b/.github/workflows/ps8-build-release.yml @@ -66,15 +66,9 @@ jobs: # It's mandatory to generate the zip inside a folder named ps_checkout, to make the zip installation working on PrestaShop - name: Generate zip run: | - ls -la cd ../ zip -r ${{ env.ZIP_NAME }}.zip ${{ github.event.repository.name }} -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' cp ${{ env.ZIP_NAME }}.zip ${{ github.event.repository.name }} - # unzip ${{ env.ZIP_NAME }}.zip -d ${{ github.event.repository.name }} - # cd ${{ github.event.repository.name }} - # zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' - # cd ../ - # cp ${{ github.event.repository.name }}/${{ env.ZIP_NAME }}.zip . - name: Push to GCP bucket storage shell: bash @@ -119,10 +113,12 @@ jobs: - name: Install composer dependencies run: composer install --no-dev -o + # It's mandatory to generate the zip inside a folder named ps_checkout, to make the zip installation working on PrestaShop - name: Generate zip run: | - cd ${{ github.event.repository.name }} - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' + cd ../ + zip -r ${{ env.ZIP_NAME }}.zip ${{ github.event.repository.name }} -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' + cp ${{ env.ZIP_NAME }}.zip ${{ github.event.repository.name }} - name: Push to GCP bucket storage shell: bash @@ -178,6 +174,7 @@ jobs: !../.editorconfig !../_dev !../tests + !../gha-creds-*.json update_release_draft_production: name: PRODUCTION - Update release draft @@ -204,7 +201,7 @@ jobs: - name: Prepare for Release run: | cd ${{ github.event.repository.name }} - zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' + zip -r ${{ env.ZIP_NAME }}.zip . -x '*.git*' -x '.php_cs.*' -x '*/node_modules' -x 'composer.*' -x 'package.*' -x '.editorconfig' -x '*_dev*' -x '*test*' -x 'gha-creds-*.json' - name: Clean existing assets shell: bash