Skip to content

Updated bot name

Updated bot name #115

Workflow file for this run

name: Build and Deploy to GKE
on:
push:
branches: [ "master" ]
env:
PROJECT_ID: nlc-bot-36685
GAR_LOCATION: us-central1
GKE_CLUSTER: main-cluster
GKE_ZONE: us-central1-c
DEPLOYMENT_NAME: alerts-server
REPOSITORY: alerts-server
IMAGE: production
jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-latest
environment: production
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@v3
# Configure Workload Identity Federation and generate an access token.
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
token_format: 'access_token'
workload_identity_provider: 'projects/742548057431/locations/global/workloadIdentityPools/github-identity-pool/providers/github-identity-provider'
service_account: '[email protected]'
- name: Docker configuration
run: |-
echo ${{steps.auth.outputs.access_token}} | docker login -u oauth2accesstoken --password-stdin https://$GAR_LOCATION-docker.pkg.dev
# Get the GKE credentials so we can deploy to the cluster
- name: Set up GKE credentials
uses: google-github-actions/get-gke-credentials@v0
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
# Build the Docker image
- name: Build
run: |-
docker image build -t ${{ env.GAR_LOCATION }}-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA -f ./build/dockerfile ./
# Push the Docker image to Google Artifact Registry
- name: Publish
run: |-
gcloud artifacts docker images delete $GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE --delete-tags || :
docker push $GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA
gcloud artifacts docker tags add $GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA "$GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:latest"
# Deploy the Docker image to the GKE cluster
- name: Deploy
run: |-
kubectl delete deployments/${{ env.DEPLOYMENT_NAME }} --namespace=alpha-bot || :
kubectl apply -f build/deployment.yaml