Skip to content

Build Image For Repo #7

Build Image For Repo

Build Image For Repo #7

Workflow file for this run

name: App Image Build And Deploy
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: environment to choice
options:
- testnet
- mainnet
env:
AWS_REGION: "ap-southeast-1"
app: dapplink-docs
permissions:
id-token: write
contents: read
run-name: Build Image For Repo
jobs:
build:
runs-on: self-hosted
outputs:
commit_sha: ${{ steps.get-commit-sha.outputs.commit_sha }}
ecr_registry: ${{ steps.login-ecr.outputs.registry }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Get Commit Sha
id: get-commit-sha
run: |
echo "::set-output name=commit_sha::$(git rev-parse --short=7 HEAD)"
- name: deploy app
run: |
registry="hkccr.ccs.tencentyun.com"
namespace="dapplink"
appname="dapplink-docs"
tag_name="${registry}/${namespace}/${appname}"
docker login --username=100003588471 -p dapplink@go hkccr.ccs.tencentyun.com
docker build --pull -t ${tag_name}:v3 .
docker push ${tag_name}:v3
HELM_OPTS="${HELM_OPTS} --set image.repository=${tag_name}"
HELM_OPTS="${HELM_OPTS} --set image.tag=v3"
if [ ${{github.event.inputs.environment }} == "testnet" ]; then
helm template ${{ env.app }} -f values.yaml charts ${HELM_OPTS}
helm upgrade --install ${{ env.app }} -f values.yaml charts ${HELM_OPTS}
else
helm template ${{ env.app }} -f values.yaml charts ${HELM_OPTS}
helm upgrade --install ${{ env.app }} -f values.yaml charts ${HELM_OPTS}
fi