Getting Started
Install and Setup Guide to Begin.
To get started, create or update your workflow file and review the usage.
You can also view the features and additional examples.
Workflow
Add the step to an existing workflow or create a new one.
If creating a new workflow, place it in the .github/workflows
directory.
- name: "Portainer Deploy"
uses: cssnr/portainer-stack-deploy-action@v1
with:
name: "stack-name"
file: "docker-compose.yaml"
url: ${{ secrets.PORTAINER_URL }}
token: ${{ secrets.PORTAINER_TOKEN }}
name: "Portainer Stack Deploy"
on:
workflow_dispatch:
jobs:
deploy:
name: "Deploy"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v5
# Add Steps to Prepare Your Stack File or Environment...
- name: "Portainer Deploy"
uses: cssnr/portainer-stack-deploy-action@v1
with:
name: "stack-name"
file: "docker-compose.yaml"
url: ${{ secrets.PORTAINER_URL }}
token: ${{ secrets.PORTAINER_TOKEN }}
Make sure to update the highlighted lines and add your secrets.
The only 3 required inputs are token, url, and name.
See the Inputs Documentation for additional options and default values.
Usage
You only need to set the name, url, token and optionally the stack file to deploy a stack.
The compose file path is relative to your working directory. If you check out your repository to the root and your compose file is in the app
directory, set file to: app/docker-compose.yaml
You can provide environment variables from either a file or JSON. If providing secrets via env_json they should come from secure input (masked).
See the Inputs Documentation for additional options and more details.
Secrets
You should store your credentials in GitHub Actions Secrets.
You do not need to add all values as a secret. However, be aware that any inputs not added as a secret, will be visible in the GitHub Actions Logs.
Likewise, if you add your GitHub username as a secret, these values will be replaced with ***
's anywhere they appear in the logs, including repository names.
If working within an GitHub Organization you can create these secrets in the organization and make them available to all your repositories. This is why I use the cssnr organization.
Native Docker
If you don't use Portainer, you can deploy directly to a native Docker host.
For this you should use: cssnr/stack-deploy-action
For more details visit the website: https://docker-deploy.cssnr.com/
Request a Feature
If you need more options, please open a feature request