[M] Deploy Faucet Testnet ( dev-testnet ) #39
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
# Deploys Faucet on Azure for Testnet | |
# Builds the Faucet network image, pushes the image to dockerhub and starts the Faucet on azure | |
# | |
# Faucet is a docker container. | |
# It exposes the following ports: | |
# HTTP: 80, | |
# | |
# Exposes the following addresses: (only accessible internally) | |
# dev-testnet-faucet or testnet-faucet.uksouth.azurecontainer.io | |
name: '[M] Deploy Faucet Testnet' | |
run-name: '[M] Deploy Faucet Testnet ( ${{ inputs.testnet_type }} )' | |
on: | |
workflow_dispatch: | |
inputs: | |
testnet_type: | |
description: 'Testnet Type' | |
required: true | |
default: 'dev-testnet' | |
type: choice | |
options: | |
- 'dev-testnet' | |
- 'uat-testnet' | |
- 'sepolia-testnet' | |
workflow_call: | |
inputs: | |
testnet_type: | |
required: true | |
type: string | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.event.inputs.testnet_type }} | |
steps: | |
- name: 'Print GitHub variables' | |
# This is a useful record of what the environment variables were at the time the job ran, for debugging and reference | |
run: | | |
echo "GitHub Variables = ${{ toJSON(vars) }}" | |
- run: echo "Workflow_dispatch inputs ${{ github.event.inputs.testnet_type }}" | |
- run: echo "Workflow_call inputs ${{ inputs.testnet_type }}" | |
- uses: actions/checkout@v4 | |
- name: 'Set up Docker' | |
uses: docker/setup-buildx-action@v1 | |
- name: 'Login to Azure docker registry' | |
uses: azure/docker-login@v1 | |
with: | |
login-server: testnetobscuronet.azurecr.io | |
username: testnetobscuronet | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: 'Login via Azure CLI' | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Build and Push Docker Image | |
run: | | |
DOCKER_BUILDKIT=1 docker build -t ${{ vars.DOCKER_BUILD_TAG_FAUCET }} -f tools/faucet/Dockerfile . | |
docker push ${{ vars.DOCKER_BUILD_TAG_FAUCET }} | |
- name: 'Deploy to Azure Container Instances' | |
uses: 'azure/aci-deploy@v1' | |
with: | |
resource-group: ${{ secrets.RESOURCE_GROUP }} | |
dns-name-label: ${{ inputs.testnet_type }}-faucet | |
image: ${{ vars.DOCKER_BUILD_TAG_FAUCET }} | |
name: ${{ inputs.testnet_type }}-faucet | |
location: 'uksouth' | |
restart-policy: 'Never' | |
environment-variables: PORT=80 | |
command-line: ./faucet --nodeHost ${{ vars.L2_RPC_URL_VALIDATOR }} --pk ${{ secrets.FAUCET_PK }} --jwtSecret ${{ secrets.FAUCET_JWT_SECRET }} --defaultAmount ${{ vars.FAUCET_PAY_AMOUNT }} | |
ports: '80' | |
cpu: 2 | |
memory: 2 |