Russell
Russell

Reputation: 978

How to deploy from Github Actions to Digital Ocean Kubernetes?

Github repo: https://github.com/jonesrussell/portfolio-sapper

Here is my Github Action YML:

name: Build and Deploy
on:
  push:
    branches:
      - main

jobs:
  export-docker:
    runs-on: ubuntu-latest
    steps:
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      - name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          push: true
          tags: jonesrussell/portfolio-app:latest
      - name: Image digest
        run: echo ${{ steps.docker_build.outputs.digest }}
      - name: DigitalOcean Kubernetes
        uses: matootie/[email protected]
        with:
          personalAccessToken: ${{ secrets.DIGITALOCEAN_TOKEN }}
          clusterName: galaxy-k8s

What I can't figure out is how to: kubectl apply -f kubernetes.yml with matootie/[email protected]

Cheers

Upvotes: 0

Views: 434

Answers (1)

matootie
matootie

Reputation: 11

What matootie/dokube does is it configures kubectl and adds it to the runner path. After you use it in your workflows you can add any additional steps using the kubectl executable as you would anything else, just as I have added to your original workflow file:

name: Build and Deploy
on:
  push:
    branches:
      - main

jobs:
  export-docker:
    runs-on: ubuntu-latest
    steps:
      ...

      - name: Apply changes
        run: kubectl apply -f kubernetes.yml

Disclaimer: I'm the author of the repository.

Upvotes: 1

Related Questions