Skip to content

Commit

Permalink
Removed old action
Browse files Browse the repository at this point in the history
  • Loading branch information
Hedgemon4 committed Jan 23, 2024
1 parent 90e68d4 commit 445743a
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 87 deletions.
81 changes: 0 additions & 81 deletions .github/workflows/deploy_staging.yml

This file was deleted.

8 changes: 2 additions & 6 deletions .github/workflows/e2e_tests_preview.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Cypress E2E Tests (Preview Deployment)

on:
# pull-request:
# types:
# - opened
# - synchronize
# - ready_for_review
pull-request:
types:
- ready_for_review

env:
AWS_REGION: ca-central-1 # set this to your preferred AWS region, e.g. us-west-1
Expand All @@ -16,7 +13,6 @@ env:
ECS_TASK_DEFINITION: amazon-ecs-task-definition.json # set this to the path to your Amazon ECS task definition
# file, e.g. .aws/task-definition.json
CONTAINER_NAME: harp-video # set this to the name of the container in the
PR_NUMBER: ${{ github.event.number }}
# containerDefinitions section of your task definition

permissions:
Expand Down
83 changes: 83 additions & 0 deletions docs/github/deploy_to_ecs_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

# This file was taken off of the Github docs and is the example for how to deploy our application to ECS

name: Deploy to Amazon ECS Staging

on:
push:

env:
AWS_REGION: ca-central-1 # set this to your preferred AWS region, e.g. us-west-1
ECR_REPOSITORY: harp-video # set this to your Amazon ECR repository name
ECS_SERVICE: harp-video-website-staging-deployment # set this to your Amazon ECS service name
ECS_CLUSTER: HarpVideoDeployment # set this to your Amazon ECS cluster name
ECS_TASK_DEFINITION: amazon-ecs-task-definition.json # set this to the path to your Amazon ECS task definition
# file, e.g. .aws/task-definition.json
CONTAINER_NAME: harp-video # set this to the name of the container in the
# containerDefinitions section of your task definition

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production

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

- name: Create env File
run: |
echo "${{ secrets.STAGING_ENV_FILE }}" > .env
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::932748244514:role/GithubActionRole
role-session-name: GithubActionRole
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile.prod .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@c804dfbdd57f713b6c079302a4c01db7017a36fc
with:
task-definition: ${{ env.ECS_TASK_DEFINITION }}
container-name: ${{ env.CONTAINER_NAME }}
image: ${{ steps.build-image.outputs.image }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true

0 comments on commit 445743a

Please sign in to comment.