From 99e97e7a65d5b774534a664641d144b68846db7a Mon Sep 17 00:00:00 2001 From: carlohcs Date: Mon, 12 Aug 2024 14:38:03 -0300 Subject: [PATCH] chore: Update GKE credentials setup and location in gc.yaml --- .github/workflows/cd.yml | 5 ++++- .github/workflows/gc.yaml | 21 ++++++++------------- src/pages/index.astro | 4 ++-- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0bcb87e..3bcbb9f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,10 +1,13 @@ -name: Deploy to EKS +name: Build and Deploy to EKS (Amazon) on: push: branches: - main jobs: deploy: + name: Setup, Build, Publish, and Deploy + # Should deploy? + if: ${{ vars.DEPLOY_TO_EKS == 'true' }} runs-on: ubuntu-latest steps: - name: Checkout code diff --git a/.github/workflows/gc.yaml b/.github/workflows/gc.yaml index 48d4310..3657201 100644 --- a/.github/workflows/gc.yaml +++ b/.github/workflows/gc.yaml @@ -12,7 +12,7 @@ # TUTORIAL: https://docs.github.com/en/actions/use-cases-and-examples/deploying/deploying-to-google-kubernetes-engine -name: Build and Deploy to GKE +name: Build and Deploy to GKE (Google) on: push: @@ -23,7 +23,7 @@ env: # GAR_LOCATION: us-central1 # TODO: update region of the Artifact Registry GAR_LOCATION: ${{ secrets.GKE_GAR_LOCATION }} # GKE_CLUSTER: cluster-1 # TODO: update to cluster name - GKE_CLUSTER: my-cluster # TODO: update to cluster name + GKE_CLUSTER: ${{ secrets.GKE_CLUSTER }} # TODO: update to cluster name # GKE_ZONE: us-central1-c # TODO: update to cluster zone GKE_ZONE: ${{ secrets.GKE_ZONE }} # TODO: update to cluster zone # DEPLOYMENT_NAME: gke-test # TODO: update to deployment name @@ -36,6 +36,8 @@ env: jobs: setup-build-publish-deploy: name: Setup, Build, Publish, and Deploy + # Should deploy? + if: ${{ vars.DEPLOY_TO_GKE == 'true' }} runs-on: ubuntu-latest environment: production @@ -59,26 +61,19 @@ jobs: # Alternative option - authentication via credentials json - name: Google Cloud auth id: 'auth' - uses: 'google-github-actions/auth@v2' + uses: google-github-actions/auth@v2 with: credentials_json: '${{ secrets.GCP_CREDENTIALS }}' - - name: 'Set up Cloud SDK' - uses: 'google-github-actions/setup-gcloud@v1' + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@v1 with: project_id: '${{ env.GKE_PROJECT }}' - - name: 'Docker auth' + - name: Docker auth run: |- gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev - # - name: Docker configuration - # run: |- - # echo ${{steps.auth.outputs.access_token}} | docker login -u oauth2accesstoken --password-stdin https://$GAR_LOCATION-docker.pkg.dev - - - name: 'Data' - run: echo GAR_LOCATION=$GAR_LOCATION && echo GKE_PROJECT=$GKE_PROJECT && echo GKE_CLUSTER=$GKE_CLUSTER && echo GKE_ZONE=$GKE_ZONE - # Get the GKE credentials so we can deploy to the cluster - name: Set up GKE credentials uses: google-github-actions/get-gke-credentials@v0 diff --git a/src/pages/index.astro b/src/pages/index.astro index 4f301d5..32cf0ff 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -3,9 +3,9 @@ import Layout from '../layouts/Layout.astro'; // import Card from '../components/Card.astro'; --- - +
-

Hello World

+

Hello World!