Skip to content

Instantly share code, notes, and snippets.

@itsmunim
Created December 29, 2021 06:51
Show Gist options
  • Save itsmunim/d231a1d7228d8fa2095b504f750446e6 to your computer and use it in GitHub Desktop.
Save itsmunim/d231a1d7228d8fa2095b504f750446e6 to your computer and use it in GitHub Desktop.
An action that can be used to apply kustomize based kubernetes manifests in a digitalocean cluster
name: "Deploy into Kubernetes"
description: "Deploys the service into kubernetes"
inputs:
digitalocean_token:
description: "Personal access token to use digitalocean CLI"
required: true
cluster_name:
description: "Name of the kubernetes cluster"
required: true
overlay_path:
description: "Path of the kustomization overlay folder"
required: true
image_name:
description: "The docker image name with repository"
required: true
tag:
description: "The image tag"
required: true
runs:
using: "composite"
steps:
- name: Setup doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ inputs.digitalocean_token }}
- name: Fetch & save digitalocean kubeconfig
shell: bash
run: doctl kubernetes cluster kubeconfig save ${{ inputs.cluster_name }} --expiry-seconds 600
- name: Deploy
shell: bash
env:
DOCKER_IMG: ${{inputs.image_name}}:${{inputs.tag}}
run: kubectl kustomize ${{inputs.overlay_path}} | sed "s|IMAGE_PLACEHOLDER|$DOCKER_IMG|g" | kubectl apply -f -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment