Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
digitalocean

GitHub Action

GitHub Action for DigitalOcean - doctl

v1.8.0

GitHub Action for DigitalOcean - doctl

digitalocean

GitHub Action for DigitalOcean - doctl

Use doctl to manage your DigitalOcean resources

Installation

Copy and paste the following snippet into your .yml file.

              

- name: GitHub Action for DigitalOcean - doctl

uses: digitalocean/[email protected]

Learn more about this action in digitalocean/action-doctl

Choose a version

GitHub Actions for DigitalOcean

This action enables you to interact with DigitalOcean services via the doctl command-line client.

Usage

As an example, one common use case is retrieving the credentials for a Kubernetes cluster hosted on DigitalOcean for use in a deployment workflow:

    - name: Save DigitalOcean kubeconfig
      uses: digitalocean/action-doctl@master
      env:
        DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
      with:
        args: kubernetes cluster kubeconfig show k8s-cluster-name > $GITHUB_WORKSPACE/.kubeconfig

See this repository for a full end-to-end example that also demonstrates building the Docker image, pushing it to Docker Hub, and using kubectl to deploy to the Kubernetes cluster on DigitalOcean.

Secrets

  • DIGITALOCEAN_ACCESS_TOKENRequired A DigitalOcean personal access token (more info).

Environment variables

We provide defaults for the following, these may also be overridden:

  • DIGITALOCEAN_OUTPUT_FORMAT- Optional doctl's output output format, defaults to json

By default, this action is configured to save output in JSON format to ${HOME}/${GITHUB_ACTION}.${DIGITALOCEAN_OUTPUT_FORMAT}for consumption by downstream actions.

License

The Dockerfile and associated scripts and documentation in this project are released under the MIT License.