Skip to content

Implement V2 Register Page User Feedback #529

Implement V2 Register Page User Feedback

Implement V2 Register Page User Feedback #529

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@v2.1.0
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 Sidekiq if triggered
if: steps.trigger-deployment.outputs.triggered == 'true'
uses: docker/build-push-action@v5
with:
context: .
push: true
file: ./Dockerfile.sidekiq
tags: |
${{ steps.login-ecr.outputs.registry }}/wca-on-rails:sidekiq-staging
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build Rails if triggered
if: steps.trigger-deployment.outputs.triggered == 'true'
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/wca-on-rails:staging
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BUILD_TAG=${{ env.SHORT_SHA }}
- 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