Skip to content

🏗️ GitHub Action for deploying stacks to Portainer.

License

Notifications You must be signed in to change notification settings

saturdayshdev/deploy-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy Action

GitHub Action for deploying stacks to Portainer.

Usage

To use this action, simply create a workflow in .github/workflows and use it:

name: Deploy

on:
  push:
    branches: [main, develop]

env:
  ENVIRONMENT: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }}
  IMAGE_PATH: docker/${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }}

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

      - uses: saturdayshdev/deploy-action@v1.0.0
        with:
          portainer-url: ${{ secrets.PORTAINER_URL }}
          portainer-username: ${{ secrets.PORTAINER_USERNAME }}
          portainer-password: ${{ secrets.PORTAINER_PASSWORD }}
          portainer-endpoint-id: ${{ vars.PORTAINER_ENDPOINT }}
          env-file: ${{ vars.ENVFILE }}
          stack-name: ${{ env.ENVIRONMENT }}-${{ github.event.repository.name }}
          stack-compose-path: ${{ env.IMAGE_PATH }}/docker-compose.yml
          stack-pull-image: true
          stack-prune: true