diff --git a/.github/workflows/actions_onlymain.yml b/.github/workflows/actions_onlymain.yml index 6bbfab35..e3398474 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,21 @@ 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/ + 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..b72e63ff 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,20 @@ 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/ + 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