The documentation you are viewing is for Dapr v1.9 which is an older version of Dapr. For up-to-date documentation, see the latest version.

Use the Dapr CLI in a GitHub Actions workflow

Add the Dapr CLI to your GitHub Actions to deploy and manage Dapr in your environments.

Dapr can be integrated with GitHub Actions via the Dapr tool installer available in the GitHub Marketplace. This installer adds the Dapr CLI to your workflow, allowing you to deploy, manage, and upgrade Dapr across your environments.

Copy and paste the following installer snippet into your applicatin’s YAML file to get started:

- name: Dapr tool installer
  uses: dapr/setup-dapr@v1

The dapr/setup-dapr action will install the specified version of the Dapr CLI on macOS, Linux, and Windows runners. Once installed, you can run any Dapr CLI command to manage your Dapr environments.

Refer to the action.yml metadata file for details about all the inputs.

Example

- name: Install Dapr
  uses: dapr/setup-dapr@v1
  with:
    version: '1.9.5'

- name: Initialize Dapr
  shell: pwsh
  run: |
    # Get the credentials to K8s to use with dapr init
    az aks get-credentials --resource-group ${{ env.RG_NAME }} --name "${{ steps.azure-deployment.outputs.aksName }}"
    
    # Initialize Dapr    
    # Group the Dapr init logs so these lines can be collapsed.
    Write-Output "::group::Initialize Dapr"
    dapr init --kubernetes --wait --runtime-version ${{ env.DAPR_VERSION }}
    Write-Output "::endgroup::"

    dapr status --kubernetes    
  working-directory: ./twitter-sentiment-processor/demos/demo3

Next steps

Learn more about GitHub Actions.


Last modified October 20, 2022: Clarify GH actions doc (#2906) (63495e4d)