Skip to content

Commit

Permalink
Push zip files at GCP bucket storage root
Browse files Browse the repository at this point in the history
  • Loading branch information
seiwan committed Nov 19, 2024
1 parent 8048514 commit b055647
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/push-to-bucket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}

0 comments on commit b055647

Please sign in to comment.