chore: add ref column #679
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 to GKE Dev | |
on: | |
push: | |
branches: | |
- cicd | |
- develop | |
# Environment variables available to all jobs and steps in this workflow | |
env: | |
GITHUB_SHA: ${{ github.sha }} | |
REGISTRY_HOSTNAME: gcr.io | |
GKE_PROJECT: df-infrastructure | |
IMAGE: fortress/api | |
K8S_ENVIRONMENT: dev | |
jobs: | |
setup-build-publish-deploy: | |
name: Setup, Build, Publish, and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- id: "auth" | |
name: "Authenticate to Google Cloud" | |
uses: "google-github-actions/auth@v0" | |
with: | |
credentials_json: "${{ secrets.GCP_CREDENTIALS }}" | |
- name: "Set up Cloud SDK" | |
uses: "google-github-actions/setup-gcloud@v0" | |
- name: Setup Docker | |
run: | | |
gcloud auth configure-docker gcr.io | |
# Build & Push the Docker image | |
- name: Build & Push | |
run: | | |
docker build -t $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${GITHUB_SHA} . | |
docker push $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${GITHUB_SHA} | |
# Setup kustomize | |
- name: Setup kustomize | |
run: | | |
curl -o kustomize --location https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64 | |
chmod u+x ./kustomize | |
mv kustomize /tmp | |
- name: Checkout dwarvesf/infrastructure | |
uses: actions/checkout@master | |
with: | |
repository: dwarvesf/infrastructure | |
token: ${{ secrets.GH_PAT }} | |
path: ./infrastructure | |
ref: main | |
- name: Update api version | |
run: | | |
cd ./infrastructure/fortress-api/$K8S_ENVIRONMENT | |
git config user.name lmquang | |
git config user.email [email protected] | |
/tmp/kustomize edit set image $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE=$REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${GITHUB_SHA} | |
git commit -am "[skip ci] fortress-api ${K8S_ENVIRONMENT} image update" | |
git push origin main |