Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cd: changing cd #349

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/data/.htaccess

This file was deleted.

18 changes: 14 additions & 4 deletions .github/data/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
FROM thiagobarradas/woocommerce:3.5.3-wp5.0.2-php7.2
ARG WORDPRESS_IMAGE_VERSION=latest
FROM wordpress:$WORDPRESS_IMAGE_VERSION
MAINTAINER Open Source Team

COPY . /app/wp-content/plugins/pagarme-payments-for-woocommerce
RUN mv /app/wp-content/plugins/pagarme-payments-for-woocommerce/.htaccess /app/.htaccess
WORKDIR /var/www/html/

WORKDIR /app
RUN apt-get update \
&& apt-get install wget -y \
&& apt-get clean

RUN wget https://github.com/DataDog/dd-trace-php/releases/latest/download/datadog-setup.php -O datadog-setup.php

RUN php datadog-setup.php --php-bin=all --enable-appsec --enable-profiling

COPY . ./wp-content

COPY plugins/pagarme-payments-for-woocommerce/.github/data/custom.ini $PHP_INI_DIR/conf.d/
4 changes: 4 additions & 0 deletions .github/data/custom.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
file_uploads = On
upload_max_filesize = 200M
post_max_size = 200M
max_execution_time = 600
40 changes: 40 additions & 0 deletions .github/data/install-zips.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

while getopts w:f:m: flag
do
case "${flag}" in
w) wcVersion=$OPTARG;;
f) wcExtraCheckoutFieldsVersion=$OPTARG;;
m) wpMailCatcherVersion=$OPTARG;;
esac
done

installZip() {
curl -L $1 -o $2
unzip $2 -d $3
rm $2
}

latestStable="latest-stable"
pluginsDir="plugins"
themesDir="themes"

wordpressDownloadUrl="https://downloads.wordpress.org"

if [[ -z "$wcVersion" ]]; then
wcVersion=$latestStable
fi

if [[ -z "$wcExtraCheckoutFieldsVersion" ]]; then
wcExtraCheckoutFieldsVersion=$latestStable
fi

if [[ -z "$wpMailCatcherVersion" ]]; then
wpMailCatcherVersion=$latestStable
fi


installZip "$wordpressDownloadUrl/plugin/woocommerce.$wcVersion.zip" "woocommerce.zip" "$pluginsDir"
installZip "$wordpressDownloadUrl/plugin/woocommerce-extra-checkout-fields-for-brazil.$wcExtraCheckoutFieldsVersion.zip" "woocommerce-extra-checkout-fields-for-brazil.zip" "$pluginsDir"
installZip "$wordpressDownloadUrl/plugin/wp-mail-catcher.$wpMailCatcherVersion.zip" "wp-mail-catcher.zip" "$pluginsDir"
installZip "$wordpressDownloadUrl/theme/storefront.$latestStable.zip" "storefront.zip" "$themesDir"
13 changes: 0 additions & 13 deletions .github/data/update-wp-config.php

This file was deleted.

4 changes: 0 additions & 4 deletions .github/data/wait-for-mysql.sh

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/build_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: BUILD BRANCH

on:
workflow_dispatch:
inputs:
wordpress_image_version:
required: false
type: string
default: latest
woocommerce_version:
required: false
type: string
default: latest-stable
woocommerce_extra_checkout_fields_version:
required: false
type: string
default: latest-stable
wp_mail_catcher_version:
required: false
type: string
default: latest-stable
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
call-workflow-cd:
uses: pagarme/woocommerce/.github/workflows/cd_reusable.yml@master
with:
tags: ${{ GITHUB_REF#refs/heads/ }}
wordpress_image_version: ${{ inputs.wordpress_image_version }}
woocommerce_version: ${{ inputs.woocommerce_version }}
woocommerce_extra_checkout_fields_version: ${{ inputs.woocommerce_extra_checkout_fields_version }}
wp_mail_catcher_version: ${{ inputs.wp_mail_catcher_version }}
secrets:
inherit
83 changes: 0 additions & 83 deletions .github/workflows/cd.yml

This file was deleted.

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
fabiano-mallmann marked this conversation as resolved.
Show resolved Hide resolved
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
call-workflow-cd:
uses: pagarme/woocommerce/.github/workflows/cd_reusable.yml@master
with:
tags: master
secrets:
inherit
17 changes: 17 additions & 0 deletions .github/workflows/cd_php8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CD PHP8

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

jobs:
call-workflow-cd:
uses: pagarme/woocommerce/.github/workflows/cd_reusable.yml@develop
with:
tags: php8
secrets:
inherit
58 changes: 58 additions & 0 deletions .github/workflows/cd_reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CD REUSABLE

on:
workflow_call:
inputs:
tag:
required: true
type: string
wordpress_image_version:
required: false
type: string
default: latest
woocommerce_version:
required: false
type: string
default: latest-stable
woocommerce_extra_checkout_fields_version:
required: false
type: string
default: latest-stable
wp_mail_catcher_version:
required: false
type: string
default: latest-stable

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: 'plugins/pagarme-payments-for-woocommerce'
- name: Download other plugins
run: |
chmod +x plugins/pagarme-payments-for-woocommerce/.github/data/install-zips.sh \
&& bash plugins/pagarme-payments-for-woocommerce/.github/data/install-zips.sh -w ${{ inputs.woocommerce_version }} -f ${{ inputs.woocommerce_extra_checkout_fields_version }} -m ${{ inputs.wp_mail_catcher_version }}
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ secrets.DOCKER_ACCOUNT }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ secrets.DOCKER_ACCOUNT }}/woocommerce-pagarme
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
build-args: |
WORDPRESS_IMAGE_VERSION=${{ inputs.wordpress_image_version }}
context: .
file: plugins/pagarme-payments-for-woocommerce/.github/data/Dockerfile
push: true
tags: ${{ secrets.DOCKER_ACCOUNT }}/woocommerce-pagarme:${{ inputs.tag }}
labels: ${{ steps.meta.outputs.labels }}
20 changes: 20 additions & 0 deletions .github/workflows/cd_stg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CD STG

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

jobs:
call-workflow-cd:
uses: pagarme/woocommerce/.github/workflows/cd_reusable.yml@develop
with:
tags: stg
wordpress_image_version: 5.2
woocommerce_version: 4.3.0
woocommerce_extra_checkout_fields_version: 3.4.0
secrets:
inherit
Loading