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 9648b64 commit ff70bbb
Show file tree
Hide file tree
Showing 4 changed files with 31 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: ps6
pr-number: pr${{ github.event.number }}
secrets: inherit

update-release-draft:
Expand Down
29 changes: 27 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,8 +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 }}
2 changes: 2 additions & 0 deletions .github/workflows/push-to-repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ jobs:
mv "$file" "$repo_name/"
fi
done
- name: Workaround actions/upload-artifact#176 🚧
id: artifacts
run: |
echo "path=$(realpath ..)" >> "$GITHUB_OUTPUT"
- name: Create & upload artifact 🛩️
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/update-release-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
run: |
cd ${{ inputs.repository-name }}
zip -r ../${{ env.ZIP_NAME }} . -x '*.DS_Store*' '*.git*' '*/.php_cs.*' '*__MACOSX*' '*/node_modules' '*/.npmrc' '*/composer.*' '*/package.*' '*/.editorconfig' '*_dev*' '*test*' '*/tests/*' '*/Test/*' '*/Tests/*' '*/gha-creds-*.json'
- name: Clean existing assets ♻️
shell: bash
run: |
Expand Down

0 comments on commit ff70bbb

Please sign in to comment.