pipe fix #4
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
73% de armazenamento usado … Você consome armazenamento quando salva arquivos no Drive, faz backup no Google Fotos e envia ou recebe e-mails do Gmail | ||
# Copyright 2019 Google, LLC. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
on: | ||
push: | ||
branches: | ||
- master | ||
name: Build and Deploy to Cloud Run | ||
env: | ||
PROJECT_ID: ${{ secrets.GCP_PROJECT }} | ||
SERVICE: ml-api | ||
REGION: us-central1 | ||
BASIC_AUTH_USERNAME: ${{ secrets.BASIC_AUTH_USERNAME }} | ||
BASIC_AUTH_PASSWORD: ${{ secrets.BASIC_AUTH_PASSWORD }} | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
# Add "id-token" with the intended permissions. | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
# Alternative option - authentication via credentials json | ||
- id: 'auth' | ||
uses: 'google-github-actions/auth@v0' | ||
with: | ||
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | ||
# Setup gcloud CLI | ||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v0 | ||
- name: Authorize Docker push | ||
run: gcloud auth configure-docker | ||
- name: Build and Push Container | ||
run: |- | ||
docker build -t gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} --build-arg BASIC_AUTH_USERNAME_ARG=${{ secrets.BASIC_AUTH_USERNAME }} --build-arg BASIC_AUTH_PASSWORD_ARG=${{ secrets.BASIC_AUTH_PASSWORD }} . | ||
docker push gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} | ||
- name: Deploy to Cloud Run | ||
run: |- | ||
gcloud run deploy ${{ env.SERVICE }} \ | ||
--region ${{ env.REGION }} \ | ||
--image gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} \ | ||
--platform "managed" \ | ||
--port 5000 |