-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PAYSHIP-3116] Deployment workflow PS 1.6.1.x (#1288)
* Deployment workflow PS 1.6 * Deployment workflow PS 1.6 * Push zip files at GCP bucket storage root
- Loading branch information
Showing
9 changed files
with
440 additions
and
101 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }}' |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: PrestaShop 1.6 - Deployment | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, edited, labeled] | ||
push: | ||
tags: | ||
- v6.* | ||
branches: | ||
- prestashop/1.6.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: ps6 | ||
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: ps6 | ||
pr-number: pr${{ github.event.number }} | ||
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 |
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
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
Oops, something went wrong.