This repository was archived by the owner on Jan 3, 2025. It is now read-only.
Allow organizer to edit reg for a user with an accepted registration in another competition in the series #363
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/pull-request-comment-trigger@v3.0.0 | |
with: | |
trigger: '@thewca-bot deploy staging' | |
reaction: rocket | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get ref from pr | |
id: comment-branch | |
uses: xt0rted/pull-request-comment-branch@v2 | |
if: steps.trigger-deployment.outputs.triggered == 'true' | |
- name: Checkout `main` branch | |
uses: actions/checkout@v4 | |
- name: Checkout 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: Build and push handler Image | |
if: steps.trigger-deployment.outputs.triggered == 'true' | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
file: dockerfile.handler | |
tags: | | |
${{ steps.login-ecr.outputs.registry }}/wca-registration-handler:staging | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
BUILD_TAG=${{ github.sha }} | |
- name: Build and push worker Image | |
if: steps.trigger-deployment.outputs.triggered == 'true' | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
file: dockerfile.worker | |
tags: | | |
${{ steps.login-ecr.outputs.registry }}/wca-registration-worker:staging | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
BUILD_TAG=${{ github.sha }} | |
- name: Deploy if triggered | |
if: steps.trigger-deployment.outputs.triggered == 'true' | |
env: | |
CLUSTER_NAME: wca-registration-staging | |
run: | | |
aws ecs update-service --cluster ${{ env.CLUSTER_NAME }} --service Staging-Service --force-new-deployment |