Portainer Stack Deploy Action

A reusable Gitea/GitHub action to automatically create or update a Docker Compose Stack in Portainer using the Portainer API.

This action is idempotent: if the stack doesn't exist, it creates it. If it exists, it updates it and pulls the latest images.

Usage

In your repository, create your .gitea/workflows/deploy.yaml and reference this action:

name: Deploy to Portainer

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      # ... (Your Docker Build and Push steps here) ...

      - name: Deploy Stack to Portainer
        uses: kaykayyali/portainer-deploy-action@main
        with:
          portainer_url: 'http://portainer.home.local:9000' # Your Portainer URL
          portainer_token: ${{ secrets.PORTAINER_API_TOKEN }}
          stack_name: 'my-awesome-app'
          compose_file: 'docker-compose.yml' # Path to your compose file in the repo

Inputs

Name Required Default Description
portainer_url Yes The full URL to your Portainer instance API
portainer_token Yes Your Portainer API Token (Access Token)
stack_name Yes The name you want to give the stack in Portainer
endpoint_id No 1 The Portainer Environment ID (Usually 1 for local)
compose_file No docker-compose.yml The relative path to your docker-compose file
Description
No description provided
Readme 45 KiB
Languages
Shell 100%