diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c69681ff7..0e117763a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: name: Tests uses: ./.github/workflows/tests.yml with: - version: master - last_published_version: dev-master + version: 2.0.x + last_published_version: 2.0.x-dev use_default_github_ref: true secrets: inherit diff --git a/.github/workflows/deploy-1.3.x.yml b/.github/workflows/deploy-1.3.x.yml index 5ab5b1d2d..5a3008ccd 100644 --- a/.github/workflows/deploy-1.3.x.yml +++ b/.github/workflows/deploy-1.3.x.yml @@ -1,8 +1,6 @@ name: Deploy 1.3.x on: - schedule: - - cron: '30 1 * * 1-5' workflow_dispatch: inputs: skip_tests: diff --git a/.github/workflows/deploy-2.0.x.yml b/.github/workflows/deploy-2.0.x.yml index 07e1263bc..14a103be0 100644 --- a/.github/workflows/deploy-2.0.x.yml +++ b/.github/workflows/deploy-2.0.x.yml @@ -1,6 +1,8 @@ name: Deploy 2.0.x on: + schedule: + - cron: '30 1 * * 1-5' workflow_dispatch: inputs: skip_tests: @@ -21,9 +23,9 @@ jobs: COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} PACKAGIST_URL: ${{ secrets.PACKAGIST_URL }} - deploy-2_0_x: + deploy-2_0_X: needs: tests - name: Deploy 2.0x + name: Deploy 2.0.x if: | always() && (needs.tests.result == 'success' || needs.tests.result == 'skipped') @@ -33,7 +35,7 @@ jobs: last_published_version: 2.0.x-dev secrets: AWS_DEPLOY_KEY: ${{ secrets.AWS_DEPLOY_KEY }} - AWS_HOSTNAME: ${{ secrets.AWS_HOSTNAME_NEW }} + AWS_HOSTNAME: ${{ secrets.AWS_HOSTNAME_STABLE }} AWS_USER: ${{ secrets.AWS_USER }} APP_SECRET: ${{ secrets.APP_SECRET }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} diff --git a/.github/workflows/deploy-int.yml.orig b/.github/workflows/deploy-int.yml.orig new file mode 100644 index 000000000..2e3bfa3fd --- /dev/null +++ b/.github/workflows/deploy-int.yml.orig @@ -0,0 +1,93 @@ +name: Deploy integration + +on: + workflow_call: + inputs: + version: + description: "Version of Gally's packages (ex: master or 1.0.x)" + required: true + type: string + last_published_version: + description: "Last release of the current version" + required: false + default: "dev-master" + type: string + back_version_is_tag: + description: "Back version to deploy is a tag ?" + required: false + default: false + type: boolean + front_version_is_tag: + description: "Front version to deploy is a tag ?" + required: false + default: false + type: boolean + secrets: + AWS_DEPLOY_KEY: + required: true + AWS_HOSTNAME: + required: true + AWS_USER: + required: true + APP_SECRET: + required: true + POSTGRES_PASSWORD: + required: true + COMPOSER_AUTH: + required: true + PACKAGIST_URL: + required: true + MEDIA_URL: + required: false + +jobs: + deploy: + name: Integration + runs-on: ubuntu-latest + + steps: + - name: Deploy in EC2 + env: + back_branch: ${{ inputs.back_version_is_tag == true && format('tags/{0}', inputs.version) || format('origin/{0}', inputs.version) }} + front_branch: ${{ inputs.version == 'master' && 'origin/main' || inputs.front_version_is_tag == true && format('tags/v{0}', inputs.version) || format('origin/{0}', inputs.version) }} + composer_version: ${{ inputs.version == 'master' && 'dev-master' || (contains(inputs.version, 'x') && format('{0}-dev', inputs.version) || inputs.version) }} + PRIVATE_KEY: ${{ secrets.AWS_DEPLOY_KEY }} + HOSTNAME : ${{ secrets.AWS_HOSTNAME }} + USER_NAME : ${{ secrets.AWS_USER }} + APP_SECRET: ${{ secrets.APP_SECRET }} + POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} + COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} + PACKAGIST_URL: ${{ secrets.PACKAGIST_URL }} + MEDIA_URL: ${{ secrets.MEDIA_URL }} + run: | + echo "$PRIVATE_KEY" > private_key && chmod 600 private_key + ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=30 -i private_key ${USER_NAME}@${HOSTNAME} " + cd /home/ubuntu/ && + [ -d gally ] || git clone https://github.com/Elastic-Suite/gally.git gally && + cd /home/ubuntu/gally && + docker system prune -af && + ([[ $(docker volume ls -q | awk '!/_/' | wc -l) -eq 0 ]] || docker volume rm $(docker volume ls -q | awk '!/_/' | tr '\n' ' ')) && + make .env && +<<<<<<< HEAD + POSTGRES_PASSWORD=$POSTGRES_PASSWORD docker compose -f compose.yml -f compose.int.yml up -d database && + docker compose -f compose.yml -f compose.int.yml down && +======= + POSTGRES_PASSWORD=$POSTGRES_PASSWORD docker compose -f compose.yml -f compose.int.yml up -d database && + docker-compose down && +>>>>>>> origin/1.3.x + git fetch --all && git reset --hard && git checkout ${{ env.back_branch }} && + [ -d front/gally-admin ] || git clone https://github.com/Elastic-Suite/gally-admin.git front/gally-admin && + cd front/gally-admin && git fetch --all && git reset --hard && git checkout ${{ env.front_branch }} && + cd /home/ubuntu/gally && + SERVER_NAME=$HOSTNAME docker compose -f compose.init_certs.yml build && + SERVER_NAME=$HOSTNAME docker compose -f compose.init_certs.yml up proxy_init_certs -d && + SERVER_NAME=$HOSTNAME docker compose -f compose.init_certs.yml up certbot_init_certs && + docker compose -f compose.init_certs.yml down && + docker compose run --rm php rm -rf vendor/gally/gally-premium && + docker compose run --rm php composer config repositories.gally-premium composer $PACKAGIST_URL && + docker compose run --rm -e COMPOSER_AUTH='$COMPOSER_AUTH' php composer require \"gally/gally-standard:${{ env.composer_version }} as ${{ inputs.last_published_version }}\" && + docker compose run --rm -e COMPOSER_AUTH='$COMPOSER_AUTH' php composer require \"gally/gally-premium:${{ env.composer_version }}\" && + docker compose run --rm -e COMPOSER_AUTH='$COMPOSER_AUTH' php composer require \"gally/gally-sample-data:${{ env.composer_version }}\" && + docker compose run --rm php sed -i \"s/DoctrineFixturesBundle::class => \['dev' => true, 'test' => true]/DoctrineFixturesBundle::class => ['all' => true]/g\" config/bundles.php && + GALLY_CATALOG_MEDIA_URL=${MEDIA_URL} SERVER_NAME=$HOSTNAME API_ROUTE_PREFIX=api APP_SECRET=$APP_SECRET POSTGRES_PASSWORD=$POSTGRES_PASSWORD COMPOSER_AUTH='$COMPOSER_AUTH' docker compose -f compose.yml -f compose.int.yml up -d --build + " diff --git a/Makefile b/Makefile index 8d7615a21..03aa3177a 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ init-dev-env: .env ## Initialize current environment with dev repositories $(MAKE) switch-dev-env switch-dev-env: ## Switch current environment with dev repositories on a composer version, pass the parameter "v=" to set the composer version, example: make switch-dev-env v=1.0.1 - @$(eval v ?= 1.3.1) + @$(eval v ?= 2.0.x-dev) $(DOCKER_COMP) up -d --wait php # Wait php container to be ready $(COMPOSER) config repositories.gally-standard '{ "type": "path", "url": "./packages/gally-standard", "options": { "versions": { "gally/gally-standard": "$(v)"}} }' $(COMPOSER) config repositories.gally-premium '{ "type": "path", "url": "./packages/gally-premium", "options": { "versions": { "gally/gally-premium": "$(v)"}} }' diff --git a/api/composer.json b/api/composer.json index b4f310adb..1b735c0a3 100644 --- a/api/composer.json +++ b/api/composer.json @@ -11,7 +11,7 @@ "doctrine/doctrine-bundle": "^2.7", "doctrine/doctrine-migrations-bundle": "^3.2", "doctrine/orm": "^2.12", - "gally/gally-standard": "dev-master", + "gally/gally-standard": "2.0.x-dev", "hautelook/alice-bundle": "2.11.0", "lexik/jwt-authentication-bundle": "^2.14", "nelmio/cors-bundle": "^2.2", diff --git a/api/composer.lock b/api/composer.lock index 111168d6b..a5dedd501 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "50d2543e32fc391c108e569de4254570", + "content-hash": "f5fbcb6850d1f4ce683e765ea0a90800", "packages": [ { "name": "api-platform/core", @@ -2053,16 +2053,16 @@ }, { "name": "gally/gally-standard", - "version": "dev-master", + "version": "2.0.x-dev", "source": { "type": "git", "url": "https://github.com/Elastic-Suite/gally-standard.git", - "reference": "2137de35789ba499996edd230c5be57d96270d1c" + "reference": "43e09f29f55c2f1623f55a0df601ec88dcb476f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Elastic-Suite/gally-standard/zipball/2137de35789ba499996edd230c5be57d96270d1c", - "reference": "2137de35789ba499996edd230c5be57d96270d1c", + "url": "https://api.github.com/repos/Elastic-Suite/gally-standard/zipball/43e09f29f55c2f1623f55a0df601ec88dcb476f7", + "reference": "43e09f29f55c2f1623f55a0df601ec88dcb476f7", "shasum": "" }, "require": { @@ -2132,7 +2132,7 @@ "issues": "https://github.com/Elastic-Suite/gally-standard/issues", "source": "https://github.com/Elastic-Suite/gally-standard/tree/master" }, - "time": "2024-09-27T08:18:49+00:00" + "time": "2024-11-07T15:58:11+00:00" }, { "name": "gedmo/doctrine-extensions",