Skip to content

Commit

Permalink
cd: add new images to cd
Browse files Browse the repository at this point in the history
 (#215)
  • Loading branch information
fabiano-mallmann authored Aug 14, 2023
1 parent d19cccc commit 7d1291e
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/data/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3.4'
volumes:
mariadb_data:
driver: local
Expand Down
6 changes: 6 additions & 0 deletions .github/data/master/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM bitnami/magento:2.4.5
MAINTAINER Open Source Team

WORKDIR /opt/bitnami/magento
COPY auth.json /opt/bitnami/magento
RUN composer require pagarme/pagarme-magento2-module:master
6 changes: 6 additions & 0 deletions .github/data/php8/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM bitnami/magento:2.4.5
MAINTAINER Open Source Team

WORKDIR /opt/bitnami/magento
COPY auth.json /opt/bitnami/magento
RUN composer require pagarme/pagarme-magento2-module:dev-stg
2 changes: 1 addition & 1 deletion .github/data/Dockerfile → .github/data/stg/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ MAINTAINER Open Source Team

WORKDIR /opt/bitnami/magento
COPY auth.json /opt/bitnami/magento
RUN composer require pagarme/pagarme-magento2-module
RUN composer require pagarme/pagarme-magento2-module:dev-stg
6 changes: 6 additions & 0 deletions .github/data/test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM bitnami/magento:2.4.3
MAINTAINER Open Source Team

WORKDIR /opt/bitnami/magento
COPY auth.json /opt/bitnami/magento
RUN composer require pagarme/pagarme-magento2-module:dev-test
17 changes: 17 additions & 0 deletions .github/workflows/cd_master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CD Master

on:
pull_request:
branches: ["master"]
types: closed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
call-workflow-cd:
uses: pagarme/magento2/.github/workflows/cd_reusable.yml@master
with:
matrix_tags: "['master']"
secrets:
inherit
44 changes: 21 additions & 23 deletions .github/workflows/cd.yml → .github/workflows/cd_reusable.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
name: CD
name: CD REUSABLE

on:
push:
branches:
- develop
- test
- stg
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
workflow_call:
inputs:
matrix_tags:
required: true
type: string

jobs:

publish:
strategy:
matrix:
tags: ${{ fromJson( inputs.matrix_tags ) }}
name: Publish
runs-on: ubuntu-latest
steps:
Expand All @@ -25,7 +23,7 @@ jobs:
run: |
cp .github/data/auth.json .
cp .github/data/docker-compose.yml .
cp .github/data/Dockerfile .
cp .github/data/${{ matrix.tags }}/Dockerfile .
cp .github/data/wait-for-mysql.sh .
cp .github/data/magento2_module_install.sql .
-
Expand Down Expand Up @@ -55,15 +53,15 @@ jobs:
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
tags: mpdockerregistry.azurecr.io/magento2-pagarme:${{ matrix.tags }}
labels: ${{ steps.meta.outputs.labels }}
# name: Commit and push Docker image
# run: |
# sleep 5 && docker stop magento2_bitnami
# docker login ${{ secrets.DOCKER_ACCOUNT }} -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
# docker commit magento2_bitnami "magento2-pagarme:${{ github.ref_name }}"
# docker push "magento2-pagarme:${{ github.ref_name }}"
# name: Send deployment webhook to Rancher
# run: |
# BODY='{"push_data":{"tag":"'"${{ github.ref }}"'"},"repository":{"repo_name":"'"${{ secrets.DOCKER_ACCOUNT }}/${{ github.repository }}"'"}}'
# curl -X POST ${{ secrets.RANCHER_STG_DEPLOY_URL }} -H 'Content-Type: application/json' -d "${BODY}"
# name: Commit and push Docker image
# run: |
# sleep 5 && docker stop magento2_bitnami
# docker login ${{ secrets.DOCKER_ACCOUNT }} -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
# docker commit magento2_bitnami "magento2-pagarme:${{ github.ref_name }}"
# docker push "magento2-pagarme:${{ github.ref_name }}"
# name: Send deployment webhook to Rancher
# run: |
# BODY='{"push_data":{"tag":"'"${{ github.ref }}"'"},"repository":{"repo_name":"'"${{ secrets.DOCKER_ACCOUNT }}/${{ github.repository }}"'"}}'
# curl -X POST ${{ secrets.RANCHER_STG_DEPLOY_URL }} -H 'Content-Type: application/json' -d "${BODY}"
17 changes: 17 additions & 0 deletions .github/workflows/cd_stg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CD STG AND PHP8

on:
pull_request:
branches: ["stg"]
types: closed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
call-workflow-cd:
uses: pagarme/magento2/.github/workflows/cd_reusable.yml@master
with:
matrix_tags: "['stg', 'php8']"
secrets:
inherit
17 changes: 17 additions & 0 deletions .github/workflows/cd_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CD TEST

on:
pull_request:
branches: ["develop"]
types: closed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
call-workflow-cd:
uses: pagarme/magento2/.github/workflows/cd_reusable.yml@master
with:
matrix_tags: "['test']"
secrets:
inherit

0 comments on commit 7d1291e

Please sign in to comment.