[M] Build and Release Frontend (dev-testnet) #105
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 TEN Gateway Frontend on Azure for Testnet | |
# Builds the TEN Gateway image, pushes the image to dockerhub and starts the TEN Gateway on Azure VM | |
# This action requires the following environment variables to be set: | |
# - DOCKER_BUILD_TAG_GATEWAY_FE | |
# - GATEWAY_URL | |
# - NETWORK_NAME | |
# - TENSCAN_URL | |
# If we are deploying to a non primary instance all those variables should be prefixed with the instance name | |
# example: dexynth-GATEWAY_URL | |
name: '[M] Build and Release Ten Gateway Frontend' | |
run-name: '[M] Build and Release Frontend (${{ github.event.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" | |
instance_type: | |
description: "Instance" | |
required: true | |
default: "primary" | |
type: choice | |
options: | |
- "primary" | |
- "dexynth" | |
gateway_url: | |
description: "Gateway URL (optional)" | |
required: false | |
tag: | |
description: "Tag to build and push (leave empty for latest)" | |
required: true | |
default: '' | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.event.inputs.testnet_type }} | |
steps: | |
- name: "Set up environment variables" | |
id: setup_env | |
run: | | |
INSTANCE_SUFFIX="" | |
INSTANCE_PREFIX="" | |
if [[ "${{ github.event.inputs.instance_type }}" != "primary" ]]; then | |
INSTANCE_SUFFIX="-${{ github.event.inputs.instance_type }}" | |
INSTANCE_PREFIX="${{ github.event.inputs.instance_type }}-" | |
fi | |
if [[ -z "${{ github.event.inputs.gateway_url }}" ]]; then | |
GATEWAY_URL="${{ env.GATEWAY_URL }}" | |
else | |
GATEWAY_URL="${{ github.event.inputs.gateway_url }}" | |
fi | |
echo "INSTANCE_SUFFIX=$INSTANCE_SUFFIX" >> $GITHUB_ENV | |
echo "INSTANCE_PREFIX=$INSTANCE_PREFIX" >> $GITHUB_ENV | |
echo "GATEWAY_URL=$GATEWAY_URL" >> $GITHUB_ENV | |
DNS_NAME_LABEL_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-ten-gateway${INSTANCE_SUFFIX}" | |
IMAGE_NAME_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-fe-ten-gateway${INSTANCE_SUFFIX}" | |
echo "DNS_NAME_LABEL_GATEWAY_FE=$DNS_NAME_LABEL_GATEWAY_FE" >> $GITHUB_ENV | |
echo "IMAGE_NAME_GATEWAY_FE=$IMAGE_NAME_GATEWAY_FE" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: "Build and Push Docker Image" | |
run: | | |
VERSION="${{ github.event.inputs.tag }}" | |
if [[ -z "$VERSION" ]]; then | |
VERSION=$(git describe --tags `git rev-list --tags --max-count=1` || echo "latest") | |
fi | |
echo "VERSION=${VERSION}" | |
DOCKER_BUILDKIT=1 docker build \ | |
--build-arg NEXT_PUBLIC_NETWORK_NAME=${{ env.NETWORK_NAME }} \ | |
--build-arg NEXT_PUBLIC_TENSCAN_URL=${{ env.TENSCAN_URL }} \ | |
--build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ | |
-t ${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} \ | |
-f ./tools/walletextension/frontend/Dockerfile . | |
docker push ${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} |