From 83d6c21f8b2445edbe6f07af0f78921f20d19f7a Mon Sep 17 00:00:00 2001 From: chabanyknikita Date: Mon, 21 Jul 2025 17:01:54 +0300 Subject: [PATCH 1/2] feat(google-auth): add unexpired kubeconfig --- .github/workflows/actions_onlymain.yml | 26 +++++++++++++++++++++----- .github/workflows/tag.yml | 22 ++++++++++++++++++---- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/.github/workflows/actions_onlymain.yml b/.github/workflows/actions_onlymain.yml index 6bbfab35..1b7ed748 100644 --- a/.github/workflows/actions_onlymain.yml +++ b/.github/workflows/actions_onlymain.yml @@ -10,6 +10,10 @@ env: DOMAIN: staging.docs.rarimo.com BASE_URL: "/" STAGING: "true" + PROJECT_ID: ${{ secrets.GKE_PROJECT }} + SA_KEY: ${{ secrets.GKE_SA_KEY }} + GKE_CLUSTER: websites + GKE_ZONE: us-central1-c jobs: converge: @@ -58,10 +62,22 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} # only needed if version is 'latest' id: install - - name: ConfigCreate + - id: 'auth' + uses: 'google-github-actions/auth@v2' + with: + project_id: '${{ env.PROJECT_ID }}' + credentials_json: '${{ env.SA_KEY }}' + + - name: Set up GKE credentials + uses: google-github-actions/get-gke-credentials@v2 + with: + cluster_name: ${{ env.GKE_CLUSTER }} + location: ${{ env.GKE_ZONE }} + namespace: docs-staging + + - name: Deploy to GKE run: | - mkdir ~/.kube/ - echo "${{ secrets.K8SCONFIG }}" | base64 -d > config - mv config ~/.kube/ - helm upgrade -i "docs" ".helm" --set global.IngressDomain=staging.docs.rarimo.com --set "image.repository=ghcr.io/${GITHUB_REPOSITORY}" --set "image.tag=${GITHUB_SHA}" --namespace docs-staging + kubectl get pods -n docs-staging + +# helm upgrade -i "docs" ".helm" --set global.IngressDomain=staging.docs.rarimo.com --set "image.repository=ghcr.io/${GITHUB_REPOSITORY}" --set "image.tag=${GITHUB_SHA}" --namespace docs-staging diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index dbd3806b..5f7bbe52 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -9,6 +9,10 @@ env: DOMAIN: staging.docs.rarimo.com BASE_URL: "/" STAGING: "false" + PROJECT_ID: ${{ secrets.GKE_PROJECT }} + SA_KEY: ${{ secrets.GKE_SA_KEY }} + GKE_CLUSTER: websites + GKE_ZONE: us-central1-c jobs: converge: @@ -57,9 +61,19 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} # only needed if version is 'latest' id: install - - name: ConfigCreate + - id: 'auth' + uses: 'google-github-actions/auth@v2' + with: + project_id: '${{ env.PROJECT_ID }}' + credentials_json: '${{ env.SA_KEY }}' + + - name: Set up GKE credentials + uses: google-github-actions/get-gke-credentials@v2 + with: + cluster_name: ${{ env.GKE_CLUSTER }} + location: ${{ env.GKE_ZONE }} + namespace: docs-prod + + - name: Deploy to GKE run: | - mkdir ~/.kube/ - echo "${{ secrets.K8SCONFIG }}" | base64 -d > config - mv config ~/.kube/ helm upgrade -i "docs" ".helm" --set global.IngressDomain=docs.rarimo.com --set "image.repository=ghcr.io/${GITHUB_REPOSITORY}" --set "image.tag=${GITHUB_REF_NAME}" --namespace docs-prod From 05888709edc6151d3007e0ffebe26781cb7b62ec Mon Sep 17 00:00:00 2001 From: chabanyknikita Date: Mon, 21 Jul 2025 17:06:14 +0300 Subject: [PATCH 2/2] chore: replace test command with helm --- .github/workflows/actions_onlymain.yml | 3 +-- .github/workflows/tag.yml | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/actions_onlymain.yml b/.github/workflows/actions_onlymain.yml index 1b7ed748..e3398474 100644 --- a/.github/workflows/actions_onlymain.yml +++ b/.github/workflows/actions_onlymain.yml @@ -78,6 +78,5 @@ jobs: - name: Deploy to GKE run: | kubectl get pods -n docs-staging - -# helm upgrade -i "docs" ".helm" --set global.IngressDomain=staging.docs.rarimo.com --set "image.repository=ghcr.io/${GITHUB_REPOSITORY}" --set "image.tag=${GITHUB_SHA}" --namespace docs-staging + helm upgrade -i "docs" ".helm" --set global.IngressDomain=staging.docs.rarimo.com --set "image.repository=ghcr.io/${GITHUB_REPOSITORY}" --set "image.tag=${GITHUB_SHA}" --namespace docs-staging diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 5f7bbe52..b72e63ff 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -76,4 +76,5 @@ jobs: - name: Deploy to GKE run: | + kubectl get pods -n docs-prod helm upgrade -i "docs" ".helm" --set global.IngressDomain=docs.rarimo.com --set "image.repository=ghcr.io/${GITHUB_REPOSITORY}" --set "image.tag=${GITHUB_REF_NAME}" --namespace docs-prod