Skip to content

Merge pull request #372 from RJ-SMTR/feat/349-relatorio #282

Merge pull request #372 from RJ-SMTR/feat/349-relatorio

Merge pull request #372 from RJ-SMTR/feat/349-relatorio #282

Workflow file for this run

name: Deploy to staging
on:
push:
branches:
- "release/*"
- "devops"
- "develop"
env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: ${{ secrets.GKE_CLUSTER_NAME }}
GKE_ZONE: us-central1-c
IMAGE: api-cct
MY_ENV: stag
jobs:
lint:
name: Dockerfiles linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run hadolint
uses: reviewdog/action-hadolint@v1
with:
hadolint_ignore: DL3008
reporter: github-pr-review
build:
needs: [lint]
name: Build and update deployments
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Google Cloud CLI
uses: google-github-actions/[email protected]
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/[email protected]
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}
- name: Mount env
run: |-
echo "${{ secrets.ENV_STAG }}" > env-deploy
- name: Build Docker image
run: |-
docker build \
--tag "gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA" \
-f Dockerfile \
.
- name: Publish Docker image
run: |-
docker push "gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA"
- name: Set up Kustomize
run: |-
cd ./.kubernetes/stag
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: Deploy
run: |-
cd ./.kubernetes/stag
./kustomize edit set image gcr.io/PROJECT_ID/IMAGE:TAG=gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA
./kustomize build . | kubectl apply -n cct-stag -f -
kubectl get services -n cct-stag -o wide