Fix request button (#19) #7
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
# https://docs.github.com/en/actions/deployment/deploying-to-your-cloud-provider/deploying-to-amazon-elastic-container-service | |
name: Deployment | |
on: | |
push: | |
branches: | |
- main | |
env: | |
ECS_TASK_DEFINITION: task-definition.json | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: ${{ github.ref_name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a | |
- name: Set Environment variables | |
run: | | |
echo WEB3_PROVIDER=${{ secrets.WEB3_PROVIDER }} > .env | |
echo ERC20_TOKEN_ADDRESS=${{ secrets.ERC20_TOKEN_ADDRESS }} >> .env | |
echo PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} >> .env | |
echo HCAPTCHA_SITEKEY=${{ secrets.HCAPTCHA_SITEKEY }} >> .env | |
echo HCAPTCHA_SECRET=${{ secrets.HCAPTCHA_SECRET }} >> .env | |
- name: Docker image | |
id: docker-image | |
run: | | |
echo "image=${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY }}:${{ github.sha }}" >> $GITHUB_OUTPUT | |
- name: Build and push the image | |
uses: docker/build-push-action@v5 | |
id: docker-build | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.docker-image.outputs.image }} | |
- name: Download task definition | |
run: | | |
aws ecs describe-task-definition --task-definition ${{ secrets.ECS_TASK }} --query taskDefinition > ${{ env.ECS_TASK_DEFINITION }} | |
- 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: ${{ github.event.repository.name }} | |
image: ${{ steps.docker-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: ${{ secrets.ECS_SERVICE }} | |
cluster: ${{ secrets.ECS_CLUSTER }} | |
wait-for-service-stability: true |