Deploy Timegift #3
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: Deploy Timegift | |
on: | |
workflow_dispatch: | |
inputs: | |
TIMEGIFT_IMAGE_TAG: | |
description: 'Tag for timegift image' | |
required: true | |
default: '1.0.0-rc1' | |
env: | |
VAULT_DOMAIN: ${{ vars.VAULT_DOMAIN }} | |
DEV_MODE: ${{ vars.DEV_MODE }} | |
HELM_CHART_URL: ${{ vars.HELM_CHART_URL }} | |
CLUSTER_NAME: ${{ vars.CLUSTER_NAME }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.6.3 | |
- name: Get Timegift Image SHA | |
id: assistos_sha | |
run: | | |
IMAGE_TAG="${{ github.event.inputs.TIMEGIFT_IMAGE_TAG }}" | |
REPOSITORY="assistos/timegift" | |
docker pull ${REPOSITORY}:${IMAGE_TAG} | |
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${REPOSITORY}:${IMAGE_TAG} | awk -F '[:@]' '{print $3}') | |
echo "TIMEGIFT_IMAGE_SHA=${DIGEST}" >> $GITHUB_ENV | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
- name: Set up doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DO_API_TOKEN }} | |
- name: Authenticate with DigitalOcean | |
run: doctl auth init -t ${{ secrets.DO_API_TOKEN }} | |
- name: Connect to Kubernetes cluster | |
run: doctl kubernetes cluster kubeconfig save ${{ env.CLUSTER_NAME }} | |
- name: Set up Kubernetes | |
uses: azure/setup-kubectl@v3 | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
- name: Deploy Timegift Helm chart | |
env: | |
SSO_SECRETS_ENCRYPTION_KEY: ${{ secrets.SSO_SECRETS_ENCRYPTION_KEY }} | |
run: | | |
helm repo add timegift ${{ env.HELM_CHART_URL }} | |
helm repo update | |
helm upgrade --install --wait --timeout 300s timegift timegift/timegift \ | |
--set config.vaultDomain="${{ env.VAULT_DOMAIN }}" \ | |
--set config.ssoSecretsEncryptionKey="${{ secrets.SSO_SECRETS_ENCRYPTION_KEY }}" \ | |
--set config.dev="${{ env.DEV_MODE }}" \ | |
--set timegift.image.tag="${{ github.event.inputs.TIMEGIFT_IMAGE_TAG }}" \ | |
--set timegift.image.sha="${{ env.TIMEGIFT_IMAGE_SHA }}" |