diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 82ca87833..cf1ad9258 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -85,6 +85,7 @@ jobs: zip-name: ${{ needs.zip-name-matrix.outputs[matrix.env.lower] }} repository-name: ${{ github.event.repository.name }} prestashop-version: ps8 + pr-number: pr${{ github.event.number }} secrets: inherit update-release-draft: diff --git a/.github/workflows/push-to-bucket.yml b/.github/workflows/push-to-bucket.yml index 33d1c3620..f6f1247e9 100644 --- a/.github/workflows/push-to-bucket.yml +++ b/.github/workflows/push-to-bucket.yml @@ -22,11 +22,35 @@ on: prestashop-version: required: true type: string + pr-number: + required: true + type: string jobs: + bucket-zip-name: + name: Generate zip file name + runs-on: ubuntu-latest + outputs: + integration: ${{ inputs.zip-name }}.zip + preproduction: ${{ inputs.zip-name }}.zip + production: ${{ steps.zip-name.outputs.name }}.zip + + steps: + - name: Generate zip file name + id: zip-name + run: | + date=$(date -d '+2 hours' +'%Y-%m-%d_%H-%M-%S') + echo "name=$REPOSITORY-$PS_VERSION-$ENV-$PR_NUMBER-$date" >> "$GITHUB_OUTPUT" + env: + ENV: production + REPOSITORY: ${{ inputs.repository-name }} + PS_VERSION: ${{ inputs.prestashop-version }} + PR_NUMBER: pr${{ inputs.pr-number }} + push-to-bucket: name: ${{ inputs.env-upper }} - Create zip file and push to GCP bucket storage runs-on: ubuntu-latest + needs: [bucket-zip-name] environment: ${{ inputs.env-lower }} permissions: id-token: write @@ -55,9 +79,9 @@ jobs: - name: Prepare zip for push 👷 run: | cd ${{ inputs.repository-name }} - zip -r ../${{ inputs.zip-name }}.zip . -x '*.DS_Store*' '*.git*' '*/.php_cs.*' '*__MACOSX*' '*/node_modules' '*/.npmrc' '*/composer.*' '*/package.*' '*/.editorconfig' '*_dev*' '*test*' '*/tests/*' '*/Test/*' '*/Tests/*' '*/gha-creds-*.json' + zip -r ../${{ needs.bucket-zip-name.outputs[inputs.env-lower] }} . -x '*.DS_Store*' '*.git*' '*/.php_cs.*' '*__MACOSX*' '*/node_modules' '*/.npmrc' '*/composer.*' '*/package.*' '*/.editorconfig' '*_dev*' '*test*' '*/tests/*' '*/Test/*' '*/Tests/*' '*/gha-creds-*.json' - name: Push to GCP bucket storage 🛩ī¸ shell: bash run: | - gsutil cp ${{ inputs.zip-name }}.zip gs://ps-eu-w1-checkout-assets-${{ inputs.env-lower }}/zips/${{ inputs.prestashop-version }} + gsutil cp ${{ needs.bucket-zip-name.outputs[inputs.env-lower] }} gs://ps-eu-w1-checkout-assets-${{ inputs.env-lower }}/zips/${{ inputs.prestashop-version }}