Skip to content

feat: Implement cross-type app conversion and enhance version management #10

feat: Implement cross-type app conversion and enhance version management

feat: Implement cross-type app conversion and enhance version management #10

name: Build & Deploy to Portainer
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: mrmigles/py-manager
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Run unit tests
run: pytest -v
build-and-push:
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
# Not needed (and not possible for fork PRs) when we're only building,
# not pushing.
- name: Log in to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# On pull requests this just validates the image builds - it's never pushed.
- name: Build image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
deploy:
runs-on: ubuntu-latest
needs: build-and-push
if: github.event_name != 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy stack to Portainer
uses: cssnr/portainer-stack-deploy-action@v1
with:
url: ${{ secrets.PORTAINER_URL }}
token: ${{ secrets.PORTAINER_TOKEN }}
name: ${{ secrets.STACK_NAME }}
file: docker-compose.yml
type: file
pull: true
prune: false
standalone: false