feat(jellyfish): add deployment notification #1
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: Helm Deployment | |
on: | |
workflow_call: | |
inputs: | |
image_tag: | |
description: "Tag of docker image to deploy" | |
required: true | |
type: string | |
namespace: | |
description: "Kubernetes namespace to deploy resources in" | |
required: false | |
default: api | |
type: string | |
values-file: | |
description: "Additional values.yaml file to include in deployment" | |
required: false | |
type: string | |
environment: | |
description: "Target environment for deployment (stg|prod)" | |
required: true | |
type: string | |
atomic: | |
description: "If true, helm upgrade uses --atomic enabling auto-rollback upon failure" | |
default: false | |
required: false | |
type: boolean | |
helm_version: | |
description: "Option to override helm version. (i.e. 'v3.6.3')" | |
default: "v3.13.1" | |
required: false | |
type: string | |
secrets: | |
k8s_server: | |
required: true | |
k8s_token: | |
required: true | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.image_tag }} | |
- name: Setup Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: ${{ inputs.helm_version }} | |
- name: Setup Kubectl | |
uses: Azure/setup-kubectl@v3 | |
- name: deploy | |
run: | | |
kubectl config set-cluster k8s --server="${{ secrets.k8s_server }}" | |
kubectl config set-credentials deploy --token="${{ secrets.k8s_token }}" | |
kubectl config set-context default --cluster=k8s --user=deploy | |
kubectl config use-context default | |
helm version | |
kubectl version | |
if [ ! -z "${{ inputs.values-file }}" ]; then | |
ARG_VALUES_FILE="-f ${{ inputs.values-file }}" | |
fi | |
WAIT_ARG="--wait" | |
if [[ "${{ inputs.atomic }}" == true ]]; then | |
WAIT_ARG="--atomic" | |
fi | |
helm upgrade ${{ github.event.repository.name }} ./deployments --install ${WAIT_ARG} --set image.tag="${{ inputs.image_tag }}" -n ${{ inputs.namespace }} ${ARG_VALUES_FILE} | |
- name: Update GitHub release | |
if: inputs.environment == 'prod' | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ inputs.image_tag }} | |
name: Release ${{ inputs.image_tag }} | |
prerelease: false | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
- name: Jellyfish Deploy Notification | |
if: inputs.environment == 'prod' | |
uses: encodium/.github/.github/workflows/jellyfish-deploy-notification.yaml@main | |
with: | |
environment: "${{ inputs.environment }}" | |
image_tag: "${{ inputs.image_tag }}" |