Skip to content

fest : ecjo

fest : ecjo #20

Workflow file for this run

name: wheretobin-cicd
on:
push:
branches: [main]
pull_request:
env:
REGION: asia-southeast1
GAR_LOCATION: asia-southeast1-docker.pkg.dev/personal-388003/demo-registry-gar
jobs:
# ==============
# CI task
# ==============
# build-and-push-image:
# environment: dev
# name: Build Docker image and push to repositories
# runs-on: ubuntu-latest
# strategy:
# matrix:
# module:
# [
# backend,
# frontend
# ]
# steps:
# - name: "Checkout"
# uses: "actions/checkout@v3"
# - name: Add image tags
# run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
# - id: "auth"
# uses: "google-github-actions/auth@v1"
# with:
# credentials_json: "${{ secrets.SERVICE_ACCOUNT_KEY }}"
# - name: "Set up Cloud SDK"
# uses: "google-github-actions/setup-gcloud@v1"
# - name: "Use gcloud CLI"
# run: "gcloud info"
# - name: "Docker auth"
# run: |-
# gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
# - name: Build image
# run: docker build -f Dockerfile -t ${{ env.GAR_LOCATION }}/${{ matrix.module }}:${{ env.SHORT_SHA }} .
# working-directory: ${{ matrix.module }}
# - name: Push image
# run: docker push ${{ env.GAR_LOCATION }}/${{ matrix.module }}:${{ env.SHORT_SHA }}
deploy:
environment: dev
name: Deploy with Terraform
runs-on: ubuntu-latest
container:
image: alpine/terragrunt
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
- name: Update dependencies
run: apk update && apk add --no-cache make
- name: Create file from secret
run: echo "${{ secrets.SERVICE_ACCOUNT_KEY }}" > ~/gcloud-sa-key.json
shell: bash
- name: "Run Terragrunt"
working-directory: "terraform"
run: |-
export GOOGLE_CREDENTIALS="~/gcloud-sa-key.json"
export IMAGE_TAG=${{ env.SHORT_SHA }}
cat $GOOGLE_CREDENTIALS
# make plan ENV=dev
# make apply ENV=dev