Skip to content

Commit

Permalink
Add CD support (#9)
Browse files Browse the repository at this point in the history
* Add deployment.yaml file

* Update default value of faucet amount to 10
  • Loading branch information
nagdahimanshu authored Jun 25, 2024
1 parent af94b98 commit 122de64
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 2 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The following are the available command-line flags(excluding above wallet flags)
| -httpport | Listener port to serve HTTP connection | 8080 |
| -proxycount | Count of reverse proxies in front of the server | 0 |
| -token-address | Token contract address | 0x8a21CF9Ba08Ae709D64Cb25AfAA951183EC9FF6D |
| -faucet.amount | Number of ERC20 tokens to transfer per user request | 1 |
| -faucet.amount | Number of ERC20 tokens to transfer per user request | 10 |
| -faucet.minutes | Number of minutes to wait between funding rounds | 10080 (1 week) |
| -faucet.name | Network name to display on the frontend | sepolia |
| -faucet.symbol | Token symbol to display on the frontend | LSK |
Expand Down
2 changes: 1 addition & 1 deletion cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
proxyCntFlag = flag.Int("proxycount", 0, "Count of reverse proxies in front of the server")
versionFlag = flag.Bool("version", false, "Print version number")

payoutFlag = flag.Int("faucet.amount", 1, "Number of ERC20 tokens to transfer per user request")
payoutFlag = flag.Int("faucet.amount", 10, "Number of ERC20 tokens to transfer per user request")
intervalFlag = flag.Int("faucet.minutes", 10080, "Number of minutes to wait between funding rounds")
netnameFlag = flag.String("faucet.name", "lisk_sepolia", "Network name to display on the frontend")
symbolFlag = flag.String("faucet.symbol", "LSK", "Token symbol to display on the frontend")
Expand Down

0 comments on commit 122de64

Please sign in to comment.