Skip to content

v6.54.0

v6.54.0 #787

Workflow file for this run

name: Build and Deploy to GKE Prod
on:
workflow_dispatch:
release:
types: [released]
# Environment variables available to all jobs and steps in this workflow
env:
REGISTRY_HOSTNAME: gcr.io
GKE_PROJECT: console-labs-prod
IMAGE: consolelabs/mochi-discord
K8S_ENVIRONMENT: prod
SHA: ${{ github.sha }}
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
# Overwrite GITHUB_SHA
- name: Set SHA
if: github.event_name == 'workflow_dispatch'
run: |
echo "SHA=${GITHUB_SHA}-$(date +%Y%m%d%H%M%S)" >> "$GITHUB_ENV"
# Build & Push the Docker image
- name: Build & Push
run: |
docker build -t $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${GITHUB_REF_NAME} .
docker push $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${GITHUB_REF_NAME}
docker tag $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${GITHUB_REF_NAME} $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${SHA}
docker push $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${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 consolelabs/infrastructure
uses: actions/checkout@master
with:
repository: consolelabs/infrastructure
token: ${{ secrets.GH_PAT }}
path: ./infrastructure
ref: main
- name: Update discord version
run: |
cd ./infrastructure/mochi-discord/$K8S_ENVIRONMENT
git config user.name jphuc96
git config user.email [email protected]
/tmp/kustomize edit set image $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE=$REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${SHA}
cd ../v2
/tmp/kustomize edit set image $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE=$REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${SHA}
git commit -am "[skip ci] mochi-discord ${K8S_ENVIRONMENT} image update"
git push origin main
notify:
name: Notify
needs: setup-build-publish-deploy
runs-on: ubuntu-latest
steps:
- name: Notify changelog
uses: fjogeleit/http-request-action@v1
if: github.event_name == 'release'
with:
url: "https://chglg.fly.dev/v1/changelog"
method: "POST"
customHeaders: '{"Content-Type": "application/json"}'
timeout: 30000
escapeData: "true"
data: >-
{
"repo": "https://github.com/${{ github.repository }}",
"tag": "${{ github.ref }}",
"access_token": "${{ secrets.GH_PAT }}",
"app_name": "Discord",
"discord": {
"webhook": "${{ secrets.DISCORD_WEBHOOK }}",
"footer": {
"icon_url": "https://cdn.discordapp.com/emojis/1039475287169183744.webp?size=44&quality=lossless"
}
}
}