-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5099deb
commit c385a71
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# This workflow will build a docker container, publish it to Google Container | ||
# Registry, and deploy it to GKE when there is a push to the "main" | ||
# branch. | ||
# | ||
# To configure this workflow: | ||
# | ||
# 1. Enable the following Google Cloud APIs: | ||
# | ||
# - Artifact Registry (artifactregistry.googleapis.com) | ||
# - Google Kubernetes Engine (container.googleapis.com) | ||
# - IAM Credentials API (iamcredentials.googleapis.com) | ||
# | ||
# You can learn more about enabling APIs at | ||
# https://support.google.com/googleapi/answer/6158841. | ||
# | ||
# 2. Ensure that your repository contains the necessary configuration for your | ||
# Google Kubernetes Engine cluster, including deployment.yml, | ||
# kustomization.yml, service.yml, etc. | ||
# | ||
# 3. Create and configure a Workload Identity Provider for GitHub: | ||
# https://github.com/google-github-actions/auth#preferred-direct-workload-identity-federation. | ||
# | ||
# Depending on how you authenticate, you will need to grant an IAM principal | ||
# permissions on Google Cloud: | ||
# | ||
# - Artifact Registry Administrator (roles/artifactregistry.admin) | ||
# - Kubernetes Engine Developer (roles/container.developer) | ||
# | ||
# You can learn more about setting IAM permissions at | ||
# https://cloud.google.com/iam/docs/manage-access-other-resources | ||
# | ||
# 5. Change the values in the "env" block to match your values. | ||
|
||
name: 'Trigger ontop-materialize job in k8s' | ||
|
||
on: | ||
push: | ||
branches: | ||
- '"main"' | ||
|
||
env: | ||
PROJECT_ID: 'golden-tenure-196110' # TODO: update to your Google Cloud project ID | ||
GAR_LOCATION: 'europe-west1' # TODO: update to your region | ||
GKE_CLUSTER: 'idorg-production' # TODO: update to your cluster name | ||
GKE_ZONE: 'europe-west1-c' | ||
IMAGE: 'static-site' | ||
WORKLOAD_IDENTITY_PROVIDER: 'projects/61618937397/locations/global/workloadIdentityPools/github/providers/my-repo' | ||
|
||
jobs: | ||
setup-build-publish-deploy: | ||
name: 'Setup and trigger job' | ||
runs-on: 'ubuntu-latest' | ||
environment: 'production' | ||
|
||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
|
||
steps: | ||
- name: 'Checkout' | ||
uses: 'actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332' # actions/checkout@v4 | ||
|
||
# Configure Workload Identity Federation and generate an access token. | ||
# | ||
# See https://github.com/google-github-actions/auth for more options, | ||
# including authenticating via a JSON credentials file. | ||
- id: 'auth' | ||
name: 'Authenticate to Google Cloud' | ||
uses: 'google-github-actions/auth@f112390a2df9932162083945e46d439060d66ec2' # google-github-actions/auth@v2 | ||
with: | ||
workload_identity_provider: '${{ env.WORKLOAD_IDENTITY_PROVIDER }}' | ||
|
||
|
||
# Get the GKE credentials so we can deploy to the cluster | ||
- name: 'Set up GKE credentials' | ||
uses: 'google-github-actions/get-gke-credentials@6051de21ad50fbb1767bc93c11357a49082ad116' # google-github-actions/get-gke-credentials@v2 | ||
with: | ||
cluster_name: '${{ env.GKE_CLUSTER }}' | ||
location: '${{ env.GKE_ZONE }}' | ||
|
||
|
||
# Deploy the Docker image to the GKE cluster | ||
- name: 'Trigger the ontop-materialize job' | ||
run: |- | ||
kubectl get pods |