From 622bd1ba77f0361d4ff15751396cfaff15f99a6e Mon Sep 17 00:00:00 2001 From: lungsangg Date: Tue, 16 Jul 2024 17:44:12 +0530 Subject: [PATCH] production_git_action_yml_update --- .github/workflows/docker-image-production.yml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/docker-image-production.yml diff --git a/.github/workflows/docker-image-production.yml b/.github/workflows/docker-image-production.yml new file mode 100644 index 0000000000..f10905e88e --- /dev/null +++ b/.github/workflows/docker-image-production.yml @@ -0,0 +1,35 @@ +name: Docker Publish Trigger + +on: + push: + branches: + - production-master # Change this to your main branch name, e.g., master + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to GitHub Container Registry + run: echo ${{ secrets.PECHA_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin + + - name: Set Env Variables in lowecase + run: | + echo "OWNER_LC=${OWNER,,}" >> ${GITHUB_ENV} + echo "REPOSITORY_LC=${REPOSITORY,,}" >> ${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' + REPOSITORY: '${{ github.repository }}' + + - name: Build Docker image + run: docker build -t ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:${{ github.sha }} . && docker tag ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:${{ github.sha }} ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:latest + + + - name: Push Docker image + run: docker push ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:${{ github.sha }} && docker push ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:latest + + - name: Deploy to render + run: curl -X POST ${{ secrets.DEPLOY_HOOK_NOTIFICATION }}ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:${{ github.sha }} \ No newline at end of file