Build Image For Repo #5
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
name: eniac-x-labs auto deployment | |
on: | |
push: | |
branches: | |
- develop | |
env: | |
AWS_REGION : "ap-southeast-1" | |
app: wallet-chain-node | |
permissions: | |
id-token: write | |
contents: read | |
run-name: Build Image For Repo | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
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 | |
with: | |
submodules: true | |
- name: Get Commit Sha | |
id: get-commit-sha | |
run: | | |
echo "::set-output name=commit_sha::$(git rev-parse --short=7 HEAD)" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: arn:aws:iam::942583694543:role/github_assume_role | |
aws-region: ${{ env.AWS_REGION }} | |
role-session-name: samplerolesession | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Build Docker Image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
REPO: ${{ env.app }} | |
#REF: ${{ github.event.inputs.ref }} | |
COMMIT_SHA: ${{ steps.get-commit-sha.outputs.commit_sha }} | |
run: | | |
IMAGE_URL1=${ECR_REGISTRY}/${REPO}:${COMMIT_SHA} | |
export NODE_OPTIONS="--max_old_space_size=9000" | |
docker build --pull -t ${IMAGE_URL1} . | |
docker push ${IMAGE_URL1} | |
- name: get helm charts | |
uses: actions/checkout@v3 | |
with: | |
repo: eniac-x-labs/savour-config | |
ref: main | |
token: ${{ secrets.GIT_TOKEN }} | |
- name: deploy app | |
run: | | |
ls -al | |
# aws eks update-kubeconfig --name savour-layer3-eks | |
# # echo 'KUBE_CONFIG_DATA<<EOF' >> $GITHUB_ENV | |
# # echo $(cat /home/runner/.kube/config | base64) >> $GITHUB_ENV | |
# # echo 'EOF' >> $GITHUB_ENV | |
# HELM_OPTS="${HELM_OPTS} --set image.repository=${{ steps.login-ecr.outputs.registry }}/${{ env.app }}" | |
# HELM_OPTS="${HELM_OPTS} --set image.tag=${{ steps.get-commit-sha.outputs.commit_sha }}" | |
# helm template ${{ env.app }} -f values.yaml charts -n testnet-layer3 ${HELM_OPTS} | |
# helm upgrade --install ${{ env.app }} -f values.yaml charts -n testnet-layer3 ${HELM_OPTS} | |
# - name: helm deploy | |
# uses: koslib/helm-eks-action@master | |
# env: | |
# KUBE_CONFIG_DATA: ${{ env.KUBE_CONFIG_DATA }} | |
# with: | |
# command: | | |
# HELM_OPTS="${HELM_OPTS} --set image.repository=${{ steps.login-ecr.outputs.registry }}/${{ env.app }}" | |
# HELM_OPTS="${HELM_OPTS} --set image.tag=${{ steps.get-commit-sha.outputs.commit_sha }}" | |
# helm template ${{ env.app }} -f values.yaml charts -n testnet-layer3 ${HELM_OPTS} | |
# helm upgrade --install ${{ env.app }} -f values.yaml charts -n testnet-layer3 ${HELM_OPTS} | |