Testing build #6
This file contains 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
## Before usage manually deploy github-oidc.yaml CloudFormation template to us-east-1 | |
## Set secrets.AWS_ROLE_ARN Github secret to name of the role cretaed by the template above | |
name: Deploy to Amazon ECS | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
AWS_REGION: us-east-1 | |
permissions: | |
id-token: write | |
contents: write | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: aws-actions/setup-sam@v2 | |
with: | |
use-installer: true | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
role-session-name: Github-Actions | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Test Env | |
id: testenv | |
run: | | |
aws s3 ls | |
aws s3 ls --region eu-central-1 | |
aws s3 ls --region eu-west-1 | |
# - 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 . | |
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
# echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT | |
# - name: Deploy env using new image | |
# id: deploy | |
# 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 . | |
# 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@v1 | |
# 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@v1 | |
# with: | |
# task-definition: ${{ steps.task-def.outputs.task-definition }} | |
# service: ${{ env.ECS_SERVICE }} | |
# cluster: ${{ env.ECS_CLUSTER }} | |
# wait-for-service-stability: true |