Viagens 2.0 - Validação de viagens #217
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: Build Fedora Image | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
# - ".github/workflows/cd.yaml" | |
- "pipelines/serpro/*" | |
- "pyproject.toml" | |
- "Dockerfile-fedora" | |
pull_request: | |
branches: | |
- main | |
paths: | |
# - ".github/workflows/cd_staging.yaml" | |
- "pipelines/serpro/*" | |
- "pyproject.toml" | |
- "Dockerfile-fedora" | |
env: | |
GKE_PROJECT_ID: ${{ secrets.GKE_PROJECT_ID }} | |
GKE_SA_KEY: ${{ secrets.GKE_SA_KEY }} | |
GKE_CLUSTER: ${{ secrets.GKE_APP_CLUSTER_NAME }} | |
GKE_ZONE: ${{ secrets.GKE_CLUSTER_ZONE }} | |
IMAGE_NAME: gcr.io/rj-smtr/pipelines-fedora | |
jobs: | |
build-container: | |
name: Build Fedora Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Python version | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
- run: |- | |
pip install --no-cache-dir -r requirements.txt | |
# - name: Update image tag in constants | |
# run: |- | |
# python .github/workflows/scripts/replace_docker_tag.py gcr.io/${{ env.GKE_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | |
# Setup gcloud CLI | |
- name: Setup Google Cloud CLI | |
uses: google-github-actions/[email protected] | |
with: | |
service_account_key: ${{ secrets.GKE_SA_KEY }} | |
project_id: ${{ secrets.GKE_PROJECT_ID}} | |
export_default_credentials: true | |
- 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 }} | |
# Configure Docker to use the gcloud command-line tool as a credential | |
# helper for authentication | |
- run: |- | |
gcloud --quiet auth configure-docker | |
- name: Build and publish image | |
run: | | |
docker build -t $IMAGE_NAME:${{ github.sha}} . -f Dockerfile-fedora | |
docker push $IMAGE_NAME:${{ github.sha }} |