-
Notifications
You must be signed in to change notification settings - Fork 38
95 lines (83 loc) · 3.41 KB
/
manual-deploy-testnet-faucet.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# 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
steps:
- run: echo "Workflow_dispatch inputs ${{ github.event.inputs.testnet_type }}"
- run: echo "Workflow_call inputs ${{ inputs.testnet_type }}"
- uses: actions/checkout@v3
- name: 'Set up Docker'
uses: docker/setup-buildx-action@v1
- name: 'Sets env vars for testnet'
if: ${{ inputs.testnet_type == 'uat-testnet' }}
run: |
echo "FAUCET_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/faucet_uat_testnet:latest" >> $GITHUB_ENV
echo "TESTNET_ADDR=erpc.uat-testnet.obscu.ro" >> $GITHUB_ENV
echo "DEFAULT_FAUCET_AMOUNT=100" >> $GITHUB_ENV
- name: 'Sets env vars for dev-testnet'
if: ${{ inputs.testnet_type == 'dev-testnet' }}
run: |
echo "FAUCET_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/faucet_dev_testnet:latest" >> $GITHUB_ENV
echo "TESTNET_ADDR=erpc.dev-testnet.obscu.ro" >> $GITHUB_ENV
echo "DEFAULT_FAUCET_AMOUNT=100" >> $GITHUB_ENV
- name: 'Sets env vars for sepolia-testnet'
if: ${{ inputs.testnet_type == 'sepolia-testnet' }}
run: |
echo "FAUCET_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/faucet_sepolia_testnet:latest" >> $GITHUB_ENV
echo "TESTNET_ADDR=erpc.sepolia-testnet.obscu.ro" >> $GITHUB_ENV
echo "DEFAULT_FAUCET_AMOUNT=0.5" >> $GITHUB_ENV
- 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 ${{env.FAUCET_BUILD_TAG}} -f tools/faucet/Dockerfile .
docker push ${{env.FAUCET_BUILD_TAG}}
- 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: ${{ env.FAUCET_BUILD_TAG }}
name: ${{ inputs.testnet_type }}-faucet
location: 'uksouth'
restart-policy: 'Never'
environment-variables: PORT=80
command-line: ./faucet --nodeHost ${{ env.TESTNET_ADDR }} --pk ${{ secrets.FAUCET_PK }} --jwtSecret ${{ secrets.FAUCET_JWT_SECRET }} --defaultAmount ${{ env.DEFAULT_FAUCET_AMOUNT }}
ports: '80'
cpu: 2
memory: 2