Skip to content

Commit

Permalink
add build/deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Raajheer1 committed Mar 28, 2024
1 parent 2c62bfd commit cb8c417
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/build_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set Tag in env variable
run: |
echo "sha_short=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
echo "${{ secrets.DOCKER_USER }}/${{ secrets.REPOSITORY_NAME }}" > APP_NAME
echo "vatusa/${{ secrets.REPOSITORY_NAME }}" > APP_NAME
echo "$GITHUB_SHA" > TAG
- name: Build the Docker image
run: docker build . --file Dockerfile --tag $(cat APP_NAME):dev-${{ github.sha }}
Expand All @@ -32,7 +32,7 @@ jobs:
- name: Set Tag in env variable
run: |
echo "sha_short=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
echo "${{ secrets.DOCKER_USER }}/${{ secrets.REPOSITORY_NAME }}" > APP_NAME
echo "vatusa/${{ secrets.REPOSITORY_NAME }}" > APP_NAME
echo "$GITHUB_SHA" > TAG
- name: Build the Docker image
run: docker build . --file Dockerfile --tag $(cat APP_NAME):${{ github.sha }}
Expand All @@ -42,3 +42,32 @@ jobs:
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }}
- name: Image push
run: docker push $(cat APP_NAME):${{ github.sha }}
deploy-dev:
name: Deploy dev to ArgoCD
runs-on: ubuntu-latest
needs: build
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
repository: 'VATUSA/gitops'
path: gitops
token: ${{ secrets.G_TOKEN }}
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v2
- name: Update manifests
run: |
cd $GITHUB_WORKSPACE/gitops/overlays/dev
kustomize edit set image vatusa/${{ secrets.REPOSITORY_NAME }}=vatusa/${{ secrets.REPOSITORY_NAME }}:${{ github.sha }}
- name: Commit and push changes
run: |
cd $GITHUB_WORKSPACE/gitops
git config --global user.email "[email protected]"
git config --global user.name "VATUSA6"
echo ${{ github.sha }}
git add .
git commit -m "Update myvatusa image tag to ${{ github.sha }}"
- name: Push to gitops repo
run: |
cd $GITHUB_WORKSPACE/gitops
git push origin main

0 comments on commit cb8c417

Please sign in to comment.