Deploy Inclusion-Prover to Mainnet - latest by @mpetrun5 #14
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
# The Licensed Work is (c) 2022 Sygma | |
# SPDX-License-Identifier: LGPL-3.0-only | |
name: Deploy Mainnet Inclusion Prover | |
on: | |
workflow_dispatch: | |
inputs: | |
release_tag: | |
description: 'The Release tag Version' | |
required: true | |
type: string | |
run-name: Deploy Inclusion-Prover to Mainnet - ${{ inputs.release_tag }} by @${{ github.actor }} | |
env: | |
ENVIRONMENT: MAINNET | |
REGISTRY: 'ghcr.io' | |
VERSION: ${{ inputs.release_tag }} | |
jobs: | |
deploy: | |
name: deploy | |
runs-on: ubuntu-latest | |
environment: mainnet | |
permissions: | |
contents: read | |
id-token: write | |
env: | |
AWS_REGION: '${{ secrets.AWS_REGION }}' | |
AWS_MAINNET: '${{ secrets.AWS_MAINNET }}' | |
steps: | |
- name: Authorised User only | |
run: | | |
if [[ ! " mpetrun5 MakMuftic eedygreen " =~ " ${{ github.actor }} " ]]; then | |
echo "You are not authorized to deploy to mainnet!" | |
exit 1 | |
fi | |
- name: checkout ecs repo | |
uses: actions/checkout@v4 | |
with: | |
repository: sygmaprotocol/devops | |
token: ${{ secrets.GHCR_TOKEN }} | |
- name: render jinja2 templates to task definition json files | |
uses: cuchi/[email protected] | |
with: | |
template: 'inclusion-prover/ecs/task_definition-${{ env.ENVIRONMENT }}.j2' | |
output_file: 'inclusion-prover/ecs/task_definition-${{ env.ENVIRONMENT }}.json' | |
data_format: json | |
variables: | | |
awsAccountId=${{ env.AWS_MAINNET }} | |
awsRegion=${{ env.AWS_REGION }} | |
awsEfs=${{ secrets.INCLUSION_EFS }} | |
imageTag=${{ env.VERSION }} | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::${{ env.AWS_MAINNET }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge | |
aws-region: ${{ env.AWS_REGION }} | |
role-session-name: GithubActions | |
- name: deploy task definition | |
uses: aws-actions/amazon-ecs-deploy-task-definition@v2 | |
with: | |
task-definition: 'inclusion-prover/ecs/task_definition-${{ env.ENVIRONMENT }}.json' | |
service: 'inclusion-prover-service-${{ env.ENVIRONMENT }}' | |
cluster: 'relayer-${{ env.ENVIRONMENT }}' | |
wait-for-service-stability: true | |
- name: slack notify | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,commit,author,action,job,eventName,ref,workflow | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: always() |