Planned vs actual #10
Workflow file for this run
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
name: Docker Image CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build the Docker image | |
run: docker build . --tag 256696114092.dkr.ecr.us-east-1.amazonaws.com/omniscope/app:${{ github.run_id }} --tag 256696114092.dkr.ecr.us-east-1.amazonaws.com/omniscope/app:latest | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: arn:aws:iam::256696114092:role/GithubDeploymentRole | |
role-session-name: GithubSession | |
aws-region: us-east-1 | |
- name: Amazon ECR Login | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Push Docker images | |
run: | | |
docker image push 256696114092.dkr.ecr.us-east-1.amazonaws.com/omniscope/app:${{ github.run_id }} | |
docker image push 256696114092.dkr.ecr.us-east-1.amazonaws.com/omniscope/app:latest | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: arn:aws:iam::256696114092:role/GithubDeploymentRole | |
role-session-name: GithubSession | |
aws-region: us-east-1 | |
#TODO: Atualizar a task definition e o service | |
- name: ECS Restart Service | |
run: aws ecs update-service --cluster arn:aws:ecs:us-east-1:256696114092:cluster/fargate-spot-stack-ecscluster7830E7B5-5A2jZtnQeSlV --service omniscope-app --region us-east-1 --force-new-deployment | |
# aws ecs update-service --cluster <nome_do_cluster> --service <nome_do_serviço> --force-new-deployment | |
# - name: ECS Restart Service | |
# uses: apideck-libraries/ecs-restart-service@v1 | |
# with: | |
# service: ominiscope-app | |
# # The short name or full Amazon Resource Name (ARN) of the cluster that your service runs on. If you do not specify a cluster, the default cluster is assumed. | |
# cluster: arn:aws:ecs:us-east-1:256696114092:cluster/fargate-spot-stack-ecscluster7830E7B5-5A2jZtnQeSlV | |