Skip to content

Commit

Permalink
Prod CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
MBarwicki committed Oct 11, 2023
1 parent 2be62e8 commit e137d1a
Showing 1 changed file with 67 additions and 1 deletion.
68 changes: 67 additions & 1 deletion .github/workflows/prod-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ jobs:
REPOSITORY: ${{ env.REPOSITORY }}
IMAGE_TAG: ${{ inputs.version }}
run: |
docker build --target final -t $REGISTRY/$REPOSITORY:apiserver-$IMAGE_TAG -f ./DockerfileApiServer .
docker build -t $REGISTRY/$REPOSITORY:apiserver-$IMAGE_TAG -f ./DockerfileRocket .
docker push $REGISTRY/$REPOSITORY:apiserver-$IMAGE_TAG
outputs:
image-version: ${{ inputs.version }}


BuildReact:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -107,3 +110,66 @@ jobs:
name: react-github-actions-build
path: ./plugin/build/**/*



DeployAPI_Prod:
runs-on: ubuntu-latest
needs: BuildAPI
steps:

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::228016254426:role/Aws-GH-Action-Assume-Role-Starknet-Production
role-session-name: GHStarknet

- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition starknet-remix-production-rocket --query taskDefinition > task-definition.json
- 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: task-definition.json
container-name: "rocket"
image: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:apiserver-${{ needs.BuildAPI.outputs.image-version }} #${{ github.run_number }}
# inject the expected React package URL for CORS logic
environment-variables: |
RUST_LOG=INFO
VITE_URL=https://cairo-remix-dev.nethermind.io
PROMTAIL_USERNAME=${{secrets.PROMTAIL_USERNAME}}
PROMTAIL_PASSWORD=${{secrets.PROMTAIL_PASSWORD}}
- 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.PROD_SERVICE_NAME }}
cluster: ${{ env.PROD_CLUSTER }}
wait-for-service-stability: true


DeployReact_Prod:
runs-on: ubuntu-latest
needs: BuildReact
steps:

- name: Get artifact
uses: actions/download-artifact@v3
with:
name: react-github-actions-build
path: artifact

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::228016254426:role/Aws-GH-Action-Assume-Role-Starknet-Production
role-session-name: GHStarknet

- name: Deploy to S3
run: aws s3 sync . s3://${{ env.PROD_BUCKET_NAME }} --acl public-read
working-directory: artifact

0 comments on commit e137d1a

Please sign in to comment.