Skip to content

Commit

Permalink
Update deploy-app.yaml
Browse files Browse the repository at this point in the history
guoshijiang authored Sep 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 10f34b3 commit ac18be2
Showing 1 changed file with 29 additions and 47 deletions.
76 changes: 29 additions & 47 deletions .github/workflows/deploy-app.yaml
Original file line number Diff line number Diff line change
@@ -17,53 +17,35 @@ permissions:
run-name: Build Image For Repo
jobs:
build:
runs-on: ubuntu-latest
runs-on: self-hosted
outputs:
commit_sha: ${{ steps.get-commit-sha.outputs.commit_sha }}
ecr_registry: ${{ steps.login-ecr.outputs.registry }}
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: 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: |
# aws s3 cp s3://eniac-x-labs-config-center/${{ env.app }}/${{ github.event.inputs.environment }}/acorus.yaml acorus.yaml
IMAGE_URL1=${ECR_REGISTRY}/${REPO}:${COMMIT_SHA}
docker build --pull -t ${IMAGE_URL1} .
docker push ${IMAGE_URL1}
- name: deploy app
run: |
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 }}"
if [ ${{github.event.inputs.environment }} == "testnet" ]; then
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}
else
helm template ${{ env.app }} -f values.yaml charts -n mainnet ${HELM_OPTS}
helm upgrade --install ${{ env.app }} -f values.yaml charts -n mainnet ${HELM_OPTS}
fi
- name: Checkout repo
uses: actions/checkout@v3
- 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="hailstone"
tag_name="${registry}/${namespace}/${appname}"
docker login --username=100003588471 -p dapplink@go hkccr.ccs.tencentyun.com
docker build --pull -t ${tag_name}:latest .
docker push ${tag_name}:latest
HELM_OPTS="${HELM_OPTS} --set image.repository=${tag_name}"
HELM_OPTS="${HELM_OPTS} --set image.tag=latest"
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 -n mainnet ${HELM_OPTS}
helm upgrade --install ${{ env.app }} -f values.yaml charts -n mainnet ${HELM_OPTS}
fi

0 comments on commit ac18be2

Please sign in to comment.