diff --git a/.github/workflows/build-and-deploy.yaml b/.github/workflows/build-and-deploy.yaml index e5edec8..6601b0a 100644 --- a/.github/workflows/build-and-deploy.yaml +++ b/.github/workflows/build-and-deploy.yaml @@ -46,11 +46,15 @@ jobs: run: | CONTAINER=$(kubectl -n $NAMESPACE get deployment homepage -o=jsonpath='{.spec.template.spec.containers[0].name}') echo "container=$CONTAINER" >> $GITHUB_OUTPUT + env: + NAMESPACE: ${{ github.ref == 'refs/heads/main' && 'prod' || 'web' }} - name: Deploy to Kubernetes run: | IMAGE="ghcr.io/${{ github.repository }}:$VERSION" - kubectl set image deployment/homepage ${{ steps.detect-container.outputs.container }}=$IMAGE -n $NAMESPACE + CONTAINER="${{ steps.detect-container.outputs.container }}" + echo "Setting image for container $CONTAINER" + kubectl set image deployment/homepage $CONTAINER=$IMAGE -n $NAMESPACE env: VERSION: ${{ vars.VERSION || 'latest' }} NAMESPACE: ${{ github.ref == 'refs/heads/main' && 'prod' || 'web' }}