add endpoint update shortlink #11
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: Release to Production GKE | |
on: | |
push: | |
branches: [main] | |
jobs: | |
deploy: | |
name: ⚙️ 🚀 🏋🏼 Setup, Build, Publish, and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Configure Docker with Credentials | |
- name: Configure Docker | |
run: | | |
docker login ${{ secrets.REGISTRY_URL }} -u ${{ secrets.REGISTRY_USERNAME }} -p "${{ secrets.REGISTRY_PASSWORD }}" | |
# Build the Docker image | |
- name: Set version tag | |
id: vars | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
file: docker/Dockerfile | |
context: . | |
push: true | |
tags: ${{ secrets.SERVICE_IMAGENAME }}:${{ env.sha_short }} | |
# GitOps | |
- name: 🧨🧨🧨 GitOps ArgoCD Setup | |
run: | | |
echo "${{ secrets.GITLAB_ARGOCD_KEY }}" > /tmp/gitlab-deploy-ssh-key | |
chmod 600 /tmp/gitlab-deploy-ssh-key | |
export GIT_SSH_COMMAND="ssh -i /tmp/gitlab-deploy-ssh-key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" | |
git clone ${{ secrets.GITLAB_ARGOCD_REPOSITORY }} | |
- name: GitOps ArgoCD Update Image Tag Shortlink Service Production | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq -i '.spec.template.spec.containers[0].image = "${{ secrets.SERVICE_IMAGENAME }}:${{ env.sha_short }}"' 'jds-terraform-gke/k8s/digiteam-shortlink/deployment.yaml' | |
- name: GitOps ArgoCD Update Image Tag Shortlink Cronjob Production | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq -i '.spec.jobTemplate.spec.template.spec.containers[0].image = "${{ secrets.SERVICE_IMAGENAME }}:${{ env.sha_short }}"' 'jds-terraform-gke/k8s/digiteam-shortlink/cronjob.yaml' | |
- name: GitOps ArgoCD Create Branch, Commit, Push | |
run: | | |
export GIT_SSH_COMMAND="ssh -i /tmp/gitlab-deploy-ssh-key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" | |
cd jds-terraform-gke/k8s/digiteam-shortlink | |
git config user.email "[email protected]" | |
git config user.name "Github Action" | |
git add . | |
git commit -m "Digiteam Shortlink Release to Production" | |
git push origin master |