updated README.md #5
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: Project gitops | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build_and_push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v2 | |
| - name: Set Short SHA | |
| run: | | |
| echo "SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_ENV | |
| - name: Build Docker Image | |
| run: | | |
| docker build -t dizevbije/project-gitops:${{ env.SHORT_SHA }} . | |
| - name: Login to Dockerhub | |
| run: | | |
| echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin | |
| - name: Push to Dockerhub | |
| run: | | |
| docker push dizevbije/project-gitops:${{ env.SHORT_SHA }} | |
| - name: Configure Git Author | |
| run: | | |
| git config --local user.name "quasar0x" | |
| git config --local user.email "dizevbije94@gmail.com" | |
| - name: Update Helm Chart with new image tag | |
| run: | | |
| sed -i "s/tag:.*/tag: ${{ env.SHORT_SHA}}/" ./helm-python-app/values.yaml | |
| git add ./helm-python-app/values.yaml | |
| git commit -m "updated image tag to ${{ env.SHORT_SHA}}" | |
| git push |