Skip to content

build-n-push_v5

build-n-push_v5 #3

Workflow file for this run

name: Deploy to GKE
on:
push:
branches:
- feat/docker
jobs:
build:
name: Building and push image to gcr
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure GCR credentials
uses: google-github-actions/setup-gcloud@v0.3.0
with:
service_account_key: ${{ secrets.GCR_SERVICE_ACCOUNT_KEY }}
project_id: ${{ secrets.PROJECT_ID }}
export_default_credentials: true
- name: Configure Docker Client
run: |-
gcloud auth configure-docker --quiet
- name: Get tag
run: echo "branch=$(echo ${GITHUB_REF_NAME})" >>$GITHUB_OUTPUT
id: get-tag
- name: Get short sha
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
id: get-short
- name: Build image web and push it
uses: docker/build-push-action@v5
with:
push: true
file: Dockerfile
tags: |
eu.gcr.io/spotistats-a49da/web:${{ steps.get-short.outputs.sha_short }}
eu.gcr.io/spotistats-a49da/web:latest
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.PAT }}
repository: statsfm/argocd
event-type: image-updates-web
client-payload: '{"tag": "${{ steps.get-tag.outputs.branch }}-${{ steps.get-short.outputs.sha_short }}"}'