Skip to content

Workflow file for this run

name: Txn Processor Controller Build/Release Workflow
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]-rc.[0-9]+"
permissions:
contents: write
packages: write
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set Latest Tag
run: echo "LATEST_RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/${{ github.repository_owner }}/txn-processor-controller:${{ env.LATEST_RELEASE_TAG }}
Deploy:
needs: [Build]
runs-on: ubuntu-latest
steps:
- name: code checkout
uses: actions/checkout@v3
- name: Set Latest Tag
run: echo "LATEST_RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}"
- name: install gcloud cli tools
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{secrets.GOOGLE_PROJECT_ID}}
service_account_key: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
install_components: "gke-gcloud-auth-plugin"
export_default_credentials: true
- name: "Configure kubectl"
run: gcloud container clusters get-credentials hypermine-gke --region=asia-south1
- name: "Replace vars"
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__LATEST_RELEASE_TAG__#${{ env.LATEST_RELEASE_TAG }}#" {} \;
- name: "Replace vars"
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__GOOGLE_APPLICATION_CREDENTIALS__#${{ vars.GOOGLE_APPLICATION_CREDENTIALS }}#" {} \;
- name: "Replace vars"
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__GLOBAL_TXN_CONTROLLER_QUEUE__#${{ vars.GLOBAL_TXN_CONTROLLER_QUEUE }}#" {} \;
- name: "Replace vars"
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__GOOGLE_CLOUD_PROJECT__#${{ vars.GOOGLE_CLOUD_PROJECT }}#" {} \;
- name: "Replace vars"
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__AMQ_URL__#${{ vars.AMQ_URL }}#" {} \;
- name: "Replace vars"
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__AMQ_URL__#${{ vars.AMQ_URL }}#" {} \;
- name: "Replace vars"
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__TXN_PROCESSOR_DYNAMIC_TAG__#${{ vars.TXN_PROCESSOR_DYNAMIC_TAG }}#" {} \;
- name: "Deploy"
run: kubectl apply -f .deploy/deployment.yaml