StuartHarris building and deploying Rust microservices 🚀 #74
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 and Deploy Rust Microservices | |
run-name: ${{ github.actor }} building and deploying Rust microservices 🚀 | |
on: | |
push: | |
branches: | |
- "main" | |
paths: | |
- "rust-containers-k8s/**" | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
branches: | |
- "main" | |
paths: | |
- "rust-containers-k8s/**" | |
jobs: | |
build-and-push: | |
if: github.event.pull_request.draft == false | |
name: Build, push and deploy 🏗️🚀 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: rust-containers-k8s | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- run: | |
echo "💡 The ${{ github.repository }} repository has been cloned to | |
the runner." | |
- name: get google-cloud-sdk-gke-gcloud-auth-plugin | |
uses: cobraz/setup-gke-gcloud-auth-plugin@v1 | |
- name: Authenticate with GCR | |
run: | | |
echo ${{ secrets.GCR_KEY_RUST }} | base64 --decode > gcr-key.json | |
gcloud auth activate-service-account --key-file=gcr-key.json | |
gcloud auth configure-docker europe-west2-docker.pkg.dev | |
gcloud container clusters get-credentials platform-poc-rust-cluster --location europe-west2 --project platform-poc-rust | |
- name: Build and push Docker images | |
run: ./scripts/build_and_push.sh | |
- name: Set short sha | |
id: vars | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: run helm upgrade | |
run: ./scripts/helm_upgrade.sh ${{ steps.vars.outputs.sha_short }} | |
- run: echo "🍏 Job's status is ${{ job.status }}." |