Merge pull request #88 from WolfeLogix/Bypass-invalid-GCP-proxy-config #56
This file contains 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: Deployment | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: | | |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:latest | |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:${{ github.sha }} | |
gcp: | |
runs-on: ubuntu-latest | |
needs: docker | |
environment: Production | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: "${{ secrets.GCP_SA_KEY }}" | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v2 | |
with: | |
version: "latest" | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
- name: Debug - Print CLOUD_RUN_SERVICE | |
run: echo "CLOUD_RUN_SERVICE is set to '${{ env.CLOUD_RUN_SERVICE }}'" | |
env: | |
CLOUD_RUN_SERVICE: ${{ github.event.repository.name }} | |
- name: Deploy to Cloud Run | |
run: | | |
gcloud run deploy "${CLOUD_RUN_SERVICE}" \ | |
--image "${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:${{ github.sha }}" \ | |
--platform managed \ | |
--region "${{ secrets.GCP_REGION }}" \ | |
--allow-unauthenticated \ | |
--project "${{ secrets.GCP_PROJECT_ID }}" \ | |
--update-secrets="PRINTIFY_API_KEY=PRINTIFY_API_KEY:latest,OPENAI_API_KEY=OPENAI_API_KEY:latest,GH_PAT=GH_PAT:latest,GH_UPLOAD_REPO=GH_UPLOAD_REPO:latest,GH_CONTENT_PREFIX=GH_CONTENT_PREFIX:latest,API_KEY=API_KEY:latest,SHOPIFY_API_KEY=SHOPIFY_API_KEY:latest,SHOPIFY_API_ACCESS_TOKEN=SHOPIFY_API_ACCESS_TOKEN:latest,SHOPIFY_SHOP_NAME=SHOPIFY_SHOP_NAME:latest" | |
env: | |
CLOUD_RUN_SERVICE: ${{ github.event.repository.name }} |