Skip to content

Migrate Competition Overview Page to React #1327

Migrate Competition Overview Page to React

Migrate Competition Overview Page to React #1327

name: Deployment to Staging
on:
issue_comment:
types:
- created
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Trigger deployment on comment
id: trigger-deployment
uses: shanegenschaw/[email protected]
with:
trigger: '@thewca-bot deploy staging'
reaction: rocket
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout primary branch
uses: actions/checkout@v4
- name: Switch to PR branch
run: gh pr checkout $PR_NUMBER
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
if: steps.trigger-deployment.outputs.triggered == 'true'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: steps.trigger-deployment.outputs.triggered == 'true'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.CI_CD_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.CI_CD_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
if: steps.trigger-deployment.outputs.triggered == 'true'
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
if: steps.trigger-deployment.outputs.triggered == 'true'
- name: Get the SHA of the current branch/fork
shell: bash
run: |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
- name: Build staging images
if: steps.trigger-deployment.outputs.triggered == 'true'
uses: ./.github/actions/build-environment
with:
environment: staging
build_tag: ${{ env.SHORT_SHA }}
registry: ${{ steps.login-ecr.outputs.registry }}/wca-on-rails
- name: Deploy staging if triggered
if: steps.trigger-deployment.outputs.triggered == 'true'
run: |
aws ecs update-service --cluster wca-on-rails --service wca-on-rails-staging --force-new-deployment
aws ecs update-service --cluster wca-on-rails --service wca-on-rails-staging-sqs-worker --force-new-deployment
aws ecs update-service --cluster wca-on-rails --service wca-on-rails-staging-API --force-new-deployment
aws ecs update-service --cluster wca-on-rails --service wca-on-rails-staging-auxiliary-services --force-new-deployment