Skip to content

Commit

Permalink
Init 2.0.x branch
Browse files Browse the repository at this point in the history
  • Loading branch information
botisSmile committed Nov 8, 2024
1 parent 2aeec8e commit 8648de7
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions .github/workflows/deploy-1.3.x.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Deploy 1.3.x

on:
schedule:
- cron: '30 1 * * 1-5'
workflow_dispatch:
inputs:
skip_tests:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/deploy-2.0.x.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Deploy 2.0.x

on:
schedule:
- cron: '30 1 * * 1-5'
workflow_dispatch:
inputs:
skip_tests:
Expand All @@ -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')
Expand All @@ -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 }}
Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/deploy-int.yml.orig
Original file line number Diff line number Diff line change
@@ -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
"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)"}} }'
Expand Down
2 changes: 1 addition & 1 deletion api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions api/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8648de7

Please sign in to comment.