This GitHub Action enables automatic deployment of applications to a CapRover server, streamlining continuous deployment workflows. Ensure you have administrative access to the CapRover server and the necessary GitHub repository permissions to implement this action.
Detailed below are the required and optional inputs for the action:
- Description: URL of your CapRover server, such as
captain.your-domain.com. - Example:
${{ secrets.CAPROVER_URL }}
- Description: Your CapRover login password to authenticate deployment requests. Omit this when using
app_token(for example on CapRover Pro with two-factor authentication enabled). - Example:
${{ secrets.CAPROVER_PASSWORD }}
- Description: App token from your app’s Deployment tab on CapRover. Use this when OTP/2FA is enabled and password-based
caprover deployno longer works. CapRover documents recommend app tokens for CI in that case. - Example:
${{ secrets.CAPROVER_APP_TOKEN }}
- Description: The name of the application configured on CapRover to receive deployments.
- Example:
${{ secrets.CAPROVER_APP }}
- Description: The GitHub repository branch from which to deploy. Defaults to the repository's main branch if not specified.
- Example:
main
- Description: The Docker image to be deployed. This can be an image hosted on Docker Hub or another registry.
- Example:
my-docker-image-name
Below are examples of how to use the action in your workflows.
When two-factor authentication is on, deploy with an app token instead of a password:
- name: Deploy to CapRover Using GitHub Actions
uses: dankore/github-to-caprover@v1.2.1
with:
server: '${{ secrets.CAPROVER_URL }}'
app_token: '${{ secrets.CAPROVER_APP_TOKEN }}'
appName: '${{ secrets.CAPROVER_APP }}'
image: 'my-docker-image-name'You can create the token in the app’s Deployment tab. The workflow is unchanged for everyone else: keep passing password and leave app_token unset.
Deploy an application using a Docker image specified in the workflow:
- name: Deploy to CapRover Using GitHub Actions
uses: dankore/github-to-caprover@v1.2.1
with:
server: '${{ secrets.CAPROVER_URL }}'
password: '${{ secrets.CAPROVER_PASSWORD }}'
appName: '${{ secrets.CAPROVER_APP }}'
image: 'my-docker-image-name'For deploying an application using an image from the GitHub Container Registry:
- name: Deploy to CapRover Using GitHub Actions
uses: dankore/github-to-caprover@v1.2.1
with:
server: '${{ secrets.CAPROVER_URL }}'
password: '${{ secrets.CAPROVER_PASSWORD }}'
appName: '${{ secrets.CAPROVER_APP }}'
image: 'ghcr.io/mygithub-username/my-docker-image-name:my-label'Deploy using an image hosted on Docker Hub:
- name: Deploy to CapRover Using GitHub Actions
uses: dankore/github-to-caprover@v1.2.1
with:
server: '${{ secrets.CAPROVER_URL }}'
password: '${{ secrets.CAPROVER_PASSWORD }}'
appName: '${{ secrets.CAPROVER_APP }}'
image: 'username/my-docker-image-name:latest'Deploy using an image from Amazon ECR:
- name: Deploy to CapRover Using GitHub Actions
uses: dankore/github-to-caprover@v1.2.1
with:
server: '${{ secrets.CAPROVER_URL }}'
password: '${{ secrets.CAPROVER_PASSWORD }}'
appName: '${{ secrets.CAPROVER_APP }}'
image: '123456789012.dkr.ecr.region.amazonaws.com/my-repo-name:tag'Deploy using an image from Google Container Registry:
- name: Deploy to CapRover Using GitHub Actions
uses: dankore/github-to-caprover@v1.2.1
with:
server: '${{ secrets.CAPROVER_URL }}'
password: '${{ secrets.CAPROVER_PASSWORD }}'
appName: '${{ secrets.CAPROVER_APP }}'
image: 'gcr.io/my-project-id/my-image-repo:my-tag'- Sensitive Data: Always use GitHub Secrets to store sensitive information such as the server URL, password, and app name to ensure security.
- Access Control: Limit access to the repository containing this workflow to trusted collaborators only.
For further details on setting up and managing deployments with CapRover, consult the CapRover documentation.