[PAYSHIP-3106] Deployment workflow PS 1.7.x #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PrestaShop 1.7 - Deployment | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, edited, labeled] | |
push: | |
tags: | |
- v7.* | |
branches: | |
- prestashop/1.7.x | |
jobs: | |
zip-name-matrix: | |
name: Generate zip file name | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
env: | |
- integration | |
- preproduction | |
outputs: | |
integration: ${{ steps.zip-name.outputs.integration }} | |
preproduction: ${{ steps.zip-name.outputs.preproduction }} | |
production: ${{ github.event.repository.name }} | |
steps: | |
- name: Generate zip file name | |
id: zip-name | |
run: | | |
date=$(date -d '+2 hours' +'%Y-%m-%d_%H-%M-%S') | |
echo "$ENV=$REPOSITORY-$PS_VERSION-$ENV-$PR_NUMBER-$date" >> "$GITHUB_OUTPUT" | |
env: | |
ENV: ${{ matrix.env }} | |
REPOSITORY: ${{ github.event.repository.name }} | |
PS_VERSION: ps7 | |
PR_NUMBER: pr${{ github.event.number }} | |
push-to-repository-matrix: | |
name: ${{ matrix.env.upper }} - Push to GitHub repository | |
needs: [zip-name-matrix] | |
strategy: | |
fail-fast: false | |
matrix: | |
env: | |
- upper: INTEGRATION | |
lower: integration | |
triggered: ${{ contains(github.event.pull_request.labels.*.name, 'integration deployment') }} | |
- upper: PREPRODUCTION | |
lower: preproduction | |
triggered: ${{ contains(github.event.pull_request.labels.*.name, 'preproduction deployment') }} | |
- upper: PRODUCTION | |
lower: production | |
triggered: ${{ github.event_name == 'push' }} | |
uses: ./.github/workflows/push-to-repository.yml | |
with: | |
env-upper: ${{ matrix.env.upper }} | |
env-lower: ${{ matrix.env.lower }} | |
triggered: ${{ matrix.env.triggered }} | |
zip-name: ${{ needs.zip-name-matrix.outputs[matrix.env.lower] }} | |
repository-name: ${{ github.event.repository.name }} | |
secrets: inherit | |
push-to-bucket-matrix: | |
name: ${{ matrix.env.upper }} - Push to GCP bucket storage | |
needs: [zip-name-matrix, push-to-repository-matrix] | |
strategy: | |
fail-fast: false | |
matrix: | |
env: | |
- lower: integration | |
upper: INTEGRATION | |
triggered: ${{ contains(github.event.pull_request.labels.*.name, 'integration deployment') }} | |
- lower: preproduction | |
upper: PREPRODUCTION | |
triggered: ${{ contains(github.event.pull_request.labels.*.name, 'preproduction deployment') }} | |
- upper: PRODUCTION | |
lower: production | |
triggered: ${{ github.event_name == 'push' }} | |
uses: ./.github/workflows/push-to-bucket.yml | |
with: | |
env-upper: ${{ matrix.env.upper }} | |
env-lower: ${{ matrix.env.lower }} | |
triggered: ${{ matrix.env.triggered }} | |
zip-name: ${{ needs.zip-name-matrix.outputs[matrix.env.lower] }} | |
repository-name: ${{ github.event.repository.name }} | |
prestashop-version: ps7 | |
secrets: inherit | |
update-release-draft: | |
name: PRODUCTION - Update release draft | |
needs: [push-to-repository-matrix] | |
uses: ./.github/workflows/update-release-draft.yml | |
with: | |
env-lower: production | |
triggered: ${{ github.event_name == 'push' }} | |
repository-name: ${{ github.event.repository.name }} | |
secrets: inherit |