Skip to content

Update README.md

Update README.md #6

Workflow file for this run

name: Argo CD Sync
on:
push:
branches:
- main
- master
jobs:
build:
name: "πŸ“¦ Build docker image and push to Amazon ECR"
runs-on: ubuntu-latest
env:
APP_NAME: hello-world-api-dotnet
timeout-minutes: 10
steps:
- name: "πŸ”§ Add dynamic envs"
run: |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
echo "SHA= ${GITHUB_SHA}"
echo "SHORT SHA= ${SHORT_SHA}"
- name: "☁️ checkout repository"
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: "πŸ”’ Login to Amazon ECR πŸ”“"
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: "πŸ“¦πŸ“‚ Build, tag, and push docker image to Amazon ECR"
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: "hello-world-api-dotnet"
IMAGE_TAG: ${{ env.SHORT_SHA }}
run: |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
update-image-stage:
name: "πŸ“ Update STAGE image tag"
runs-on: ubuntu-latest
needs:
- build
timeout-minutes: 10
steps:
- name: "πŸ”§ Add dynamic envs"
id: "image-tag"
run: |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
echo "SHA= ${GITHUB_SHA}"
echo "SHORT SHA= ${SHORT_SHA}"
echo "::set-output name=version::$SHORT_SHA"
- name: Checkout Target Repository
uses: actions/checkout@v3
with:
repository: "OpsVerseIO/deployment-manifests"
path: main
token: ${{ secrets.GH_PAT }}
- name: "πŸ“ Update Image tag Version in the DEV manifest file"
uses: OpsVerseIO/[email protected]
with:
repository: "OpsVerseIO/deployment-manifests"
valueFile: 'hello-world-api-dotnet/helm/stage/values.yaml'
propertyPath: 'helloworldapidotnet.image.tag'
value: '${{ env.SHORT_SHA }}'
branch: main
createPR: false
message: '[STAGE] Update Image tag of hello-world-api-dotnet'
token: ${{ secrets.GH_PAT }}
workDir: main
masterBranchName: main
targetBranch: main
force: true
updateFile: true
release-stage:
name: "πŸš€ Deploy to STAGE (ArgoCD Sync)"
runs-on: ubuntu-latest
needs:
- build
- update-image-stage
timeout-minutes: 10
steps:
- name: "πŸ”§ Trigger ArgoCD Sync/Deployment in STAGE"
uses: opsverseio/[email protected]
with:
address: ${{ secrets.ARGOCD_SERVER }}
token: ${{ secrets.ARGOCD_TOKEN }}
action: sync
appName: ${{ secrets.ARGOCD_STAGE_APP_NAME }}
disableTlsVerification: "true"
- name: "πŸš€ Deploy to STAGE"
run: |
echo "⏳ Deploying the application to STAGE"
echo "πŸš€βœ…πŸ’š Successfully synced STAGE ArgoCD and deployed the application to STAGE"