diff --git a/.github/actions/deploy.yaml b/.github/actions/deploy.yaml new file mode 100644 index 000000000..9f5ad66ec --- /dev/null +++ b/.github/actions/deploy.yaml @@ -0,0 +1,34 @@ +on: + workflow_call: + inputs: + environment: + required: true + type: string + description: The environment to deploy to + secrets: + AWS_ROLE_TO_ASSUME + +jobs: + deploy: + name: Deploy to ${{ environment }} + environment: ${{ environment }} + concurrency: deploy-hub-${{ environment }} + runs-on: ubuntu-22.04 + permissions: + id-token: write + contents: read + + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: eu-west-1 + role-duration-seconds: 3600 + role-session-name: GithubCerpusDevDeploy + + - name: Re-deploy docker-compose on Elastic Beanstalk + run: | + aws elasticbeanstalk update-environment + --environment-name ${{ vars.HUB_ENVIRONMENT_NAME }} + --version-label ${{ vars.HUB_APPLICATION_VERSION }} diff --git a/.github/workflows/contentauthor.yaml b/.github/workflows/contentauthor.yaml index bd10c44cc..b09d29ee7 100644 --- a/.github/workflows/contentauthor.yaml +++ b/.github/workflows/contentauthor.yaml @@ -3,7 +3,7 @@ name: Content Author on: push: branches: - - hubbub + - edlib3 paths: - '.github/workflows/contentauthor.yaml' - 'sourcecode/apis/contentauthor/**' @@ -11,7 +11,7 @@ on: - 'v*' pull_request: branches: - - hubbub + - edlib3 paths: - '.github/workflows/contentauthor.yaml' - 'sourcecode/apis/contentauthor/**' @@ -37,7 +37,7 @@ jobs: run: composer validate php-cs-fixer: - if: github.ref != 'refs/heads/hubbub' + if: github.ref != 'refs/heads/edlib3' needs: [composer-validate] runs-on: ubuntu-22.04 @@ -165,14 +165,13 @@ jobs: test-image \ vendor/bin/phpunit --coverage-clover /reports/coverage.xml - # TODO: uncomment when repo is opened - #- name: Upload coverage to Codecov - # if: github.event_name == 'push' && github.ref != 'refs/heads/hubbub' - # uses: codecov/codecov-action@v4 - # with: - # token: ${{ secrets.CODECOV_TOKEN }} - # files: /tmp/coverage.xml - # context: sourcecode/apis/contentauthor + - name: Upload coverage to Codecov + if: github.event_name == 'push' && github.ref != 'refs/heads/edlib3' + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: /tmp/coverage.xml + context: sourcecode/apis/contentauthor - name: Gather Docker metadata for PHP image id: php_meta @@ -181,7 +180,7 @@ jobs: images: | name=ghcr.io/cerpus/edlib-contentauthor tags: | - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/hubbub' }},prefix=php- + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/edlib3' }},prefix=php- type=semver,pattern={{version}},prefix=php- type=semver,pattern={{major}}.{{minor}},prefix=php- type=semver,pattern={{major}},prefix=php- @@ -195,7 +194,7 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max context: sourcecode/apis/contentauthor - push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/hubbub' }} + push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/edlib3' }} target: prod tags: ${{ steps.php_meta.outputs.tags }} @@ -206,7 +205,7 @@ jobs: images: | name=ghcr.io/cerpus/edlib-contentauthor tags: | - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/hubbub' }},prefix=web- + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/edlib3' }},prefix=web- type=semver,pattern={{version}},prefix=web- type=semver,pattern={{major}}.{{minor}},prefix=web- type=semver,pattern={{major}},prefix=web- @@ -220,7 +219,7 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max context: sourcecode/apis/contentauthor - push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/hubbub' }} + push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/edlib3' }} target: web tags: ${{ steps.web_meta.outputs.tags }} @@ -231,7 +230,7 @@ jobs: deploy-eb: name: Deploy CA to test environments - if: always() && needs.build_test_publish.result == 'success' && github.event_name == 'push' && github.ref == 'refs/heads/hubbub' + if: always() && needs.build_test_publish.result == 'success' && github.event_name == 'push' && github.ref == 'refs/heads/edlib3' needs: [build_test_publish] strategy: matrix: @@ -259,4 +258,4 @@ jobs: - name: Re-deploy docker-compose on Elastic Beanstalk run: | - aws elasticbeanstalk update-environment --environment-name ${{ vars.CA_ENVIRONMENT_NAME }} --version-label ${{ vars.CA_APPLICATION_VERSION }} \ No newline at end of file + aws elasticbeanstalk update-environment --environment-name ${{ vars.CA_ENVIRONMENT_NAME }} --version-label ${{ vars.CA_APPLICATION_VERSION }} diff --git a/.github/workflows/hub.yaml b/.github/workflows/hub.yaml index 95b88b41d..b5f3d5d7d 100644 --- a/.github/workflows/hub.yaml +++ b/.github/workflows/hub.yaml @@ -3,7 +3,7 @@ name: Hub on: push: branches: - - hubbub + - edlib3 paths: - ".github/workflows/hub.yaml" - "sourcecode/hub/**" @@ -11,7 +11,7 @@ on: - 'v*' pull_request: branches: - - hubbub + - edlib3 paths: - '.github/workflows/hub.yaml' - 'sourcecode/hub/**' @@ -37,7 +37,7 @@ jobs: run: composer validate --no-check-publish php-cs-fixer: - if: github.ref != 'refs/heads/hubbub' + if: github.ref != 'refs/heads/edlib3' needs: [composer-validate] runs-on: ubuntu-22.04 @@ -201,7 +201,7 @@ jobs: images: | name=ghcr.io/cerpus/edlib-hub tags: | - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/hubbub' }},prefix=php- + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/edlib3' }},prefix=php- type=semver,pattern={{version}},prefix=php- type=semver,pattern={{major}}.{{minor}},prefix=php- type=semver,pattern={{major}},prefix=php- @@ -215,7 +215,7 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/buildx-cache-new,mode=max context: sourcecode/hub - push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/hubbub' }} + push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/edlib3' }} target: prod tags: ${{ steps.php_meta.outputs.tags }} @@ -226,7 +226,7 @@ jobs: images: | name=ghcr.io/cerpus/edlib-hub tags: | - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/hubbub' }},prefix=web- + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/edlib3' }},prefix=web- type=semver,pattern={{version}},prefix=web- type=semver,pattern={{major}}.{{minor}},prefix=web- type=semver,pattern={{major}},prefix=web- @@ -240,7 +240,7 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max context: sourcecode/hub - push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/hubbub' }} + push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/edlib3' }} target: web tags: ${{ steps.web_meta.outputs.tags }} @@ -251,7 +251,7 @@ jobs: deploy-eb: name: Deploy hub to test environments - if: always() && needs.build_test_publish.result == 'success' && github.event_name == 'push' && github.ref == 'refs/heads/hubbub' + if: always() && needs.build_test_publish.result == 'success' && github.event_name == 'push' && github.ref == 'refs/heads/edlib3' needs: [build_test_publish] strategy: matrix: @@ -279,4 +279,4 @@ jobs: - name: Re-deploy docker-compose on Elastic Beanstalk run: | - aws elasticbeanstalk update-environment --environment-name ${{ vars.HUB_ENVIRONMENT_NAME }} --version-label ${{ vars.HUB_APPLICATION_VERSION }} \ No newline at end of file + aws elasticbeanstalk update-environment --environment-name ${{ vars.HUB_ENVIRONMENT_NAME }} --version-label ${{ vars.HUB_APPLICATION_VERSION }} diff --git a/docker-compose.yml b/docker-compose.yml index 635013d0f..b474a0b85 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,7 +72,6 @@ services: redis: { condition: service_healthy } env_file: - ./localSetup/projects/content-author/.env - - ./localSetup/.env command: /startup.sh healthcheck: test: [CMD, nc, -z, localhost, "9000"] @@ -91,7 +90,6 @@ services: contentauthor-fpm: { condition: service_healthy } env_file: - ./localSetup/projects/content-author/.env - - ./localSetup/.env volumes: - ./data/nginx/ca:/usr/local/share/ca-certificates:ro - ./sourcecode/apis/contentauthor:/app @@ -107,7 +105,6 @@ services: redis: { condition: service_healthy } env_file: - ./localSetup/projects/content-author/.env - - ./localSetup/.env volumes: - ./data/nginx/ca:/usr/local/share/ca-certificates:ro - ./sourcecode/apis/contentauthor:/app