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

Refactor deploy workflow #2927

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
34 changes: 0 additions & 34 deletions .github/actions/deploy.yaml

This file was deleted.

33 changes: 10 additions & 23 deletions .github/workflows/contentauthor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,33 +229,20 @@ jobs:
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

deploy-eb:
name: Deploy CA to test environments
name: Deploy CA
if: always() && needs.build_test_publish.result == 'success' && github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [build_test_publish]
environment: ${{ matrix.environment }}
strategy:
matrix:
environment:
- test
- ndla_staging
environment: ${{ matrix.environment }}
concurrency: deploy-ca-${{ matrix.environment }}
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4

- 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.CA_ENVIRONMENT_NAME }} --version-label ${{ vars.CA_APPLICATION_VERSION }}
uses: ./.github/workflows/deploy.yaml
with:
name: Content Author
environment: ${{ matrix.environment }}
environment_name: ${{ vars.CA_ENVIRONMENT_NAME }}
version: ${{ vars.CA_APPLICATION_VERSION }}
secrets:
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
39 changes: 39 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on:
workflow_call:
inputs:
environment:
required: true
type: string
environment_name:
required: true
type: string
name:
required: true
type: string
version:
required: true
type: string
secrets:
aws_role_to_assume:
required: true

jobs:
deploy:
name: Deploy ${{ inputs.name }} to ${{ inputs.environment }}
concurrency: deploy-${{ inputs.name }}-${{ inputs.environment }}
runs-on: ubuntu-24.04

steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-1
role-to-assume: ${{ secrets.aws_role_to_assume }}
role-duration-seconds: 3600
role-session-name: GithubCerpusDevDeploy

- name: Re-deploy docker-compose on Elastic Beanstalk
run: |
aws elasticbeanstalk update-environment \
--environment-name ${{ inputs.environment_name }} \
--version-label ${{ inputs.version }}
32 changes: 10 additions & 22 deletions .github/workflows/hub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,33 +250,21 @@ jobs:
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

deploy-eb:
name: Deploy hub to test environments
name: Deploy hub
if: always() && needs.build_test_publish.result == 'success' && github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [build_test_publish]
environment: ${{ matrix.environment }}
strategy:
matrix:
environment:
- test
- ndla_staging
environment: ${{ matrix.environment }}
concurrency: deploy-hub-${{ matrix.environment }}
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
use: ./.github/workflows/deploy.yaml
with:
name: Hub
environment: ${{ matrix.environment }}
environment_name: ${{ vars.HUB_ENVIRONMENT_NAME }}
version: ${{ vars.HUB_APPLICATION_VERSION }}
secrets:
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}

steps:
- name: Checkout
uses: actions/checkout@v4

- 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 }}
Loading