Skip to content

Deploy to DigitalOcean Kubernetes #17

Deploy to DigitalOcean Kubernetes

Deploy to DigitalOcean Kubernetes #17

Workflow file for this run

name: Deploy to DigitalOcean Kubernetes
on:
workflow_run:
workflows:
- "Publish UI to Docker image"
- "Publish API to Docker image"
- "Publish Website to Docker image"
- "Publish Base UI to Docker image"
- "Publish Base API to Docker image"
branches: [main]
types:
- completed
workflow_dispatch:
inputs:
services:
description: 'Services to deploy (comma-separated)'
required: false
default: 'all'
type: string
force_deploy:
description: 'Force deployment regardless of previous workflow status'
required: false
default: false
type: boolean
jobs:
deploy:
# Run if either:
# 1. Triggered by workflow_run and that workflow succeeded
# 2. Manually triggered (workflow_dispatch)
if: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
env:
KUBECONFIG: ${{ github.workspace }}/kubeconfig.yaml
DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
CLUSTER_NAME: ${{ secrets.CLUSTER_NAME }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save ${{ secrets.CLUSTER_NAME }}
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: 'latest'
- name: Deploy rustlemania-ui
if: ${{ github.event.inputs.services == 'all' || contains(github.event.inputs.services, 'rustlemania-ui') }}
run: |
# Update chart dependencies
helm dependency update ./helm/rustlemania-ui
# Upgrade or install if not exists
helm upgrade --install rustlemania-ui ./helm/rustlemania-ui \
--namespace default \
--atomic \
--set "podAnnotations.rollme=\"$(date +%s)\"" \
-f ./helm/rustlemania-ui/values.yaml
- name: Deploy rustlemania-websocket
if: ${{ github.event.inputs.services == 'all' || contains(github.event.inputs.services, 'rustlemania-websocket') }}
run: |
# Update chart dependencies
helm dependency update ./helm/rustlemania-websocket
# Upgrade or install if not exists
helm upgrade --install rustlemania-websocket ./helm/rustlemania-websocket \
--namespace default \
--atomic \
--set "podAnnotations.rollme=\"$(date +%s)\"" \
-f ./helm/rustlemania-websocket/values.yaml
- name: Deploy rustlemania-webtransport
if: ${{ github.event.inputs.services == 'all' || contains(github.event.inputs.services, 'rustlemania-webtransport') }}
run: |
# Update chart dependencies
helm dependency update ./helm/rustlemania-webtransport
# Upgrade or install if not exists
helm upgrade --install rustlemania-webtransport ./helm/rustlemania-webtransport \
--namespace default \
--atomic \
--set "podAnnotations.rollme=\"$(date +%s)\"" \
-f ./helm/rustlemania-webtransport/values.yaml
- name: Deploy videocall-website
if: ${{ github.event.inputs.services == 'all' || contains(github.event.inputs.services, 'videocall-website') }}
run: |
# Update chart dependencies
helm dependency update ./helm/videocall-website
# Upgrade or install if not exists
helm upgrade --install videocall-website ./helm/videocall-website \
--namespace default \
--atomic \
--set "podAnnotations.rollme=\"$(date +%s)\"" \
-f ./helm/videocall-website/values.yaml