Updated UI #4
This file contains hidden or 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: CI Pipeline | |
| on: | |
| push: | |
| paths: | |
| - "app-code/**" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout app repo | |
| uses: actions/checkout@v3 | |
| - name: Login to DockerHub | |
| run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
| - name: Build Image | |
| run: docker build -t ${{ secrets.DOCKER_USERNAME }}/gitops-nginx:${{ github.sha }} ./app-code | |
| - name: Push Image | |
| run: docker push ${{ secrets.DOCKER_USERNAME }}/gitops-nginx:${{ github.sha }} | |
| # 🔥 NEW STEP (MOST IMPORTANT) | |
| - name: Update GitOps Repo | |
| run: | | |
| git clone https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/dvanhu/gitops-multi-env-deployment.git | |
| cd gitops-multi-env-deployment | |
| sed -i "s|image: .*|image: dvanhu/gitops-nginx:${{ github.sha }}|" apps/nginx/base/deployment.yaml | |
| git config user.name "github-actions" | |
| git config user.email "actions@github.com" | |
| git add . | |
| git commit -m "update image to ${{ github.sha }}" | |
| git push |