Skip to content

tidy code, write a bunch of helpers #11

tidy code, write a bunch of helpers

tidy code, write a bunch of helpers #11

Workflow file for this run

# For more support on how to run the workflow, please visit https://github.com/google-github-actions/setup-gcloud/tree/master/example-workflows/gke-kustomize
name: Build and Push to GCR
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
env:
PROJECT_ID: maplectf
GCR_URL: us.gcr.io
IMAGE: instanced
jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
runs-on: self-hosted
environment: production
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Alternative option - authentication via credentials json
- id: 'auth'
name: 'Authenticate to GCP'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
project_id: $PROJECT_ID
- name: 'Set up gcloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'
with:
version: '442.0.0'
- name: Check gcloud
run: |
set -x
gcloud info
- name: Docker configuration
run: |-
gcloud auth configure-docker $GCR_URL
# Build the Docker image
- name: Build
run: |-
docker build \
--tag "$GCR_URL/$PROJECT_ID/$IMAGE:$GITHUB_SHA" \
--tag "$GCR_URL/$PROJECT_ID/$IMAGE:latest" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
.
# Push the Docker image to Google Artifact Registry
- name: Publish
run: |-
docker push "$GCR_URL/$PROJECT_ID/$IMAGE:latest"