fix: service_id "base" para pesquisa (#103) #44
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: cd-prod | |
on: | |
push: | |
branches: | |
- "master" | |
env: | |
PROJECT_ID: ${{ secrets.GKE_PROJECT }} | |
GKE_CLUSTER: ${{ secrets.GKE_CLUSTER_NAME }} | |
GKE_ZONE: us-central1-c | |
IMAGE: mobilidade-rio-app | |
MY_ENV: production | |
jobs: | |
build: | |
name: Build and update deployments | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Google Cloud CLI | |
uses: google-github-actions/setup-gcloud@v0.2.1 | |
with: | |
service_account_key: ${{ secrets.GKE_SA_KEY }} | |
project_id: ${{ secrets.GKE_PROJECT }} | |
- name: Configure Docker with gcloud | |
run: |- | |
gcloud --quiet auth configure-docker | |
- name: Get GKE credentials | |
uses: google-github-actions/get-gke-credentials@v0.2.1 | |
with: | |
cluster_name: ${{ env.GKE_CLUSTER }} | |
location: ${{ env.GKE_ZONE }} | |
credentials: ${{ secrets.GKE_SA_KEY }} | |
- name: Build Docker image | |
run: |- | |
docker build \ | |
--tag "gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA" \ | |
. | |
- name: Publish Docker image | |
run: |- | |
docker push "gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA" | |
- name: Set up Kustomize | |
run: |- | |
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64 | |
chmod u+x ./kustomize | |
- name: Applying environment name | |
run: |- | |
envsubst < kustomization.yaml.tmpl > kustomization.yaml | |
- name: Deploy | |
run: |- | |
./kustomize edit set image gcr.io/PROJECT_ID/IMAGE_APP:TAG=gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA | |
./kustomize build . | kubectl apply -n mobilidade-v2 -f - | |
kubectl get services -n mobilidade-v2 -o wide |