Skip to content

Rollout

Rollout #6

Workflow file for this run

name: Rollout
on:
workflow_dispatch:
jobs:
set_environment:
runs-on: ubuntu-latest
steps:
- name: Set up environment based on branch
id: environment_check
shell: bash
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
BRANCH_NAME=${BRANCH_NAME#refs/tags/}
ENVIRONMENT="development"
if [[ "$BRANCH_NAME" == v* ]]; then
ENVIRONMENT="production"
fi
echo "environment=${ENVIRONMENT,,}" >> $GITHUB_OUTPUT
outputs:
environment: ${{ steps.environment_check.outputs.environment }}
rollout:
runs-on: ubuntu-latest
needs: set_environment
permissions:
id-token: write
contents: read
environment: ${{ needs.set_environment.outputs.environment }}
env:
ENVIRONMENT: ${{ needs.set_environment.outputs.environment }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- name: Deploying services with an env file
uses: brunocascio/ecs-deploy@v2.2.0
env:
CLUSTER_NAME: ${{ env.ENVIRONMENT }}-graphacademy-cluster
SERVICE_NAME: ${{ env.ENVIRONMENT }}-graphacademy-service
with:
args: deploy ${{ env.CLUSTER_NAME }} ${{ env.SERVICE_NAME }} --timeout -1