Skip to content

Commit

Permalink
testnet: Continous deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
bobcoin98 committed Apr 11, 2024
1 parent 40731b9 commit 1497ee9
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/deploy-viction-by-codebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Deploy Docker Image By Codebuild

on:
workflow_call:
inputs:
aws_region:
type: string
default: "ap-southeast-1"
aws_account_id:
required: true
type: string
aws_role_assume_name:
required: true
type: string
codebuild_project_name:
required: true
type: string
culiops_branch:
type: string
default: "main"
app_branch:
type: string
default: "master"
app_repo_name:
required: true
type: string
ecs_cluster_name:
type: string
default: "tomochain-testnet"
ecs_service_name:
required: true
type: string

jobs:
codebuild:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: ${{ inputs.aws_region }}
role-to-assume: arn:aws:iam::${{ inputs.aws_account_id }}:role/${{ inputs.aws_role_assume_name }}

- name: Get AWS caller identity
run: aws sts get-caller-identity

- name: Trigger CodeBuild
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: ${{ inputs.codebuild_project_name }}
disable-source-override: true
env-vars-for-codebuild: |
AWS_DEFAULT_REGION,
AWS_ACCOUNT_ID,
CULIOPS_BRANCH,
ECS_CLUSTER_NAME,
BUILD_TYPE,
APP_BRANCH,
APP_REPO_NAME,
TRIGGERED_BY
env:
AWS_DEFAULT_REGION: ${{ inputs.aws_region }}
AWS_ACCOUNT_ID: ${{ inputs.aws_account_id }}
CULIOPS_BRANCH: ${{ inputs.culiops_branch }}
ECS_CLUSTER_NAME: ${{ inputs.ecs_cluster_name }}
BUILD_TYPE: ${{ inputs.ecs_service_name }}
APP_BRANCH: ${{ inputs.app_branch }}
APP_REPO_NAME: ${{ inputs.app_repo_name }}
TRIGGERED_BY: ${{ github.actor }}
48 changes: 48 additions & 0 deletions .github/workflows/testnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Testnet
#Build and Deploy Viction Scan UI on Testnet

on: workflow_dispatch

env:
APPLICATION: "tomochain"
ENVIRONMENT: "testnet"
AWS_REGION: "ap-southeast-1"
CULIOPS_BRANCH: "main"
ECS_SERVICE_NAME: "issuer-web"
APP_REPO_NAME: "tomoissuer"
APP_BRANCH: "master"

permissions:
id-token: write
contents: write
actions: write

jobs:
set_vars:
runs-on: ubuntu-latest
outputs:
aws_region: ${{ env.AWS_REGION }}
aws_account_id: "604763758327"
aws_role_assume_name: "${{ env.APPLICATION }}-ci-${{ env.ENVIRONMENT }}"
codebuild_project_name: "${{ env.APPLICATION }}-${{ env.ENVIRONMENT }}"
culiops_branch: ${{ env.CULIOPS_BRANCH }}
ecs_cluster_name: "${{ env.APPLICATION }}-${{ env.ENVIRONMENT }}"
ecs_service_name: ${{ env.ECS_SERVICE_NAME }}
app_repo_name: ${{ env.APP_REPO_NAME }}
app_branch: ${{ env.APP_BRANCH }}
steps:
- run: echo "Exposing ENV vars"

deploy:
needs: [set_vars]
uses: BuildOnViction/tomoissuer/.github/workflows/deploy-viction-by-codebuild.yml@master
with:
aws_region: ${{ needs.set_vars.outputs.aws_region }}
aws_account_id: ${{ needs.set_vars.outputs.aws_account_id }}
aws_role_assume_name: ${{ needs.set_vars.outputs.aws_role_assume_name }}
codebuild_project_name: ${{ needs.set_vars.outputs.codebuild_project_name }}
culiops_branch: ${{ needs.set_vars.outputs.culiops_branch }}
ecs_cluster_name: ${{ needs.set_vars.outputs.ecs_cluster_name }}
ecs_service_name: ${{ needs.set_vars.outputs.ecs_service_name }}
app_repo_name: ${{ needs.set_vars.outputs.app_repo_name }}
app_branch: ${{ needs.set_vars.outputs.app_branch }}

0 comments on commit 1497ee9

Please sign in to comment.