Merge pull request #26 from hypersign-protocol/CD #21
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: Vault Service Build and Publish to google artifact repository | |
on: | |
push: | |
branches: | |
- "master" | |
jobs: | |
Build-and-Publish-to-google-artifact-repository: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: code checkout | |
uses: actions/checkout@v3 | |
- 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: "Use gcloud CLI" | |
run: "gcloud info" | |
- name: "Docker Auth" | |
run: gcloud auth configure-docker asia-south1-docker.pkg.dev | |
- name: "Docker Build and Push" | |
env: | |
GOOGLE_PROJECT_ID: ${{secrets.GOOGLE_PROJECT_ID}} | |
GOOGLE_ARTIFACT_URL: ${{secrets.GOOGLE_ARTIFACT_URL}} | |
GOOGLE_ARTIFACT_REPO: ${{secrets.GOOGLE_ARTIFACT_REPO}} | |
run: | |
docker build -t $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/vault-service:latest . | |
docker push $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/vault-service:latest | |
- name: "Configure kubectl" | |
run: gcloud container clusters get-credentials hypermine-gke --region=asia-south1 | |
- name: "Replace secrets" | |
uses: cschleiden/replace-tokens@v1 | |
with: | |
files: '["**/deployment.yaml"]' | |
tokenPrefix: __ | |
tokenSuffix: __ | |
env: | |
HOST: ${{secrets.HOST}} | |
ABSOLUTE_URL: ${{secrets.ABSOLUTE_URL}} | |
DATA_VAULT: ${{secrets.DATA_VAULT}} | |
DB_URL: ${{secrets.DB_URL}} | |
PORT: ${{ secrets.PORT }} | |
LOG_LEVEL: ${{secrets.LOG_LEVEL}} | |
SSL: ${{secrets.SSL}} | |
- name: "Deploy to GKE" | |
run: kubectl apply -f deploy/deployment.yaml |