Skip to content

Commit 1497ee9

Browse files
committed
testnet: Continous deployment
1 parent 40731b9 commit 1497ee9

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Deploy Docker Image By Codebuild
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
aws_region:
7+
type: string
8+
default: "ap-southeast-1"
9+
aws_account_id:
10+
required: true
11+
type: string
12+
aws_role_assume_name:
13+
required: true
14+
type: string
15+
codebuild_project_name:
16+
required: true
17+
type: string
18+
culiops_branch:
19+
type: string
20+
default: "main"
21+
app_branch:
22+
type: string
23+
default: "master"
24+
app_repo_name:
25+
required: true
26+
type: string
27+
ecs_cluster_name:
28+
type: string
29+
default: "tomochain-testnet"
30+
ecs_service_name:
31+
required: true
32+
type: string
33+
34+
jobs:
35+
codebuild:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Configure AWS credentials
39+
uses: aws-actions/configure-aws-credentials@v2
40+
with:
41+
aws-region: ${{ inputs.aws_region }}
42+
role-to-assume: arn:aws:iam::${{ inputs.aws_account_id }}:role/${{ inputs.aws_role_assume_name }}
43+
44+
- name: Get AWS caller identity
45+
run: aws sts get-caller-identity
46+
47+
- name: Trigger CodeBuild
48+
uses: aws-actions/aws-codebuild-run-build@v1
49+
with:
50+
project-name: ${{ inputs.codebuild_project_name }}
51+
disable-source-override: true
52+
env-vars-for-codebuild: |
53+
AWS_DEFAULT_REGION,
54+
AWS_ACCOUNT_ID,
55+
CULIOPS_BRANCH,
56+
ECS_CLUSTER_NAME,
57+
BUILD_TYPE,
58+
APP_BRANCH,
59+
APP_REPO_NAME,
60+
TRIGGERED_BY
61+
env:
62+
AWS_DEFAULT_REGION: ${{ inputs.aws_region }}
63+
AWS_ACCOUNT_ID: ${{ inputs.aws_account_id }}
64+
CULIOPS_BRANCH: ${{ inputs.culiops_branch }}
65+
ECS_CLUSTER_NAME: ${{ inputs.ecs_cluster_name }}
66+
BUILD_TYPE: ${{ inputs.ecs_service_name }}
67+
APP_BRANCH: ${{ inputs.app_branch }}
68+
APP_REPO_NAME: ${{ inputs.app_repo_name }}
69+
TRIGGERED_BY: ${{ github.actor }}

.github/workflows/testnet.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Testnet
2+
#Build and Deploy Viction Scan UI on Testnet
3+
4+
on: workflow_dispatch
5+
6+
env:
7+
APPLICATION: "tomochain"
8+
ENVIRONMENT: "testnet"
9+
AWS_REGION: "ap-southeast-1"
10+
CULIOPS_BRANCH: "main"
11+
ECS_SERVICE_NAME: "issuer-web"
12+
APP_REPO_NAME: "tomoissuer"
13+
APP_BRANCH: "master"
14+
15+
permissions:
16+
id-token: write
17+
contents: write
18+
actions: write
19+
20+
jobs:
21+
set_vars:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
aws_region: ${{ env.AWS_REGION }}
25+
aws_account_id: "604763758327"
26+
aws_role_assume_name: "${{ env.APPLICATION }}-ci-${{ env.ENVIRONMENT }}"
27+
codebuild_project_name: "${{ env.APPLICATION }}-${{ env.ENVIRONMENT }}"
28+
culiops_branch: ${{ env.CULIOPS_BRANCH }}
29+
ecs_cluster_name: "${{ env.APPLICATION }}-${{ env.ENVIRONMENT }}"
30+
ecs_service_name: ${{ env.ECS_SERVICE_NAME }}
31+
app_repo_name: ${{ env.APP_REPO_NAME }}
32+
app_branch: ${{ env.APP_BRANCH }}
33+
steps:
34+
- run: echo "Exposing ENV vars"
35+
36+
deploy:
37+
needs: [set_vars]
38+
uses: BuildOnViction/tomoissuer/.github/workflows/deploy-viction-by-codebuild.yml@master
39+
with:
40+
aws_region: ${{ needs.set_vars.outputs.aws_region }}
41+
aws_account_id: ${{ needs.set_vars.outputs.aws_account_id }}
42+
aws_role_assume_name: ${{ needs.set_vars.outputs.aws_role_assume_name }}
43+
codebuild_project_name: ${{ needs.set_vars.outputs.codebuild_project_name }}
44+
culiops_branch: ${{ needs.set_vars.outputs.culiops_branch }}
45+
ecs_cluster_name: ${{ needs.set_vars.outputs.ecs_cluster_name }}
46+
ecs_service_name: ${{ needs.set_vars.outputs.ecs_service_name }}
47+
app_repo_name: ${{ needs.set_vars.outputs.app_repo_name }}
48+
app_branch: ${{ needs.set_vars.outputs.app_branch }}

0 commit comments

Comments
 (0)