Add docker-compose.yml and Gitea Actions workflow
Build & Deploy / build-and-deploy (push) Has been cancelled

This commit is contained in:
Ricardo Mancinas
2026-07-11 19:00:48 -07:00
parent 4c69ae1529
commit aadd136592
2 changed files with 66 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
name: Build & Deploy
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Gitea Registry
uses: docker/login-action@v3
with:
registry: git.mancinas.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: git.mancinas.io/rmancinas/ascii-art-app:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy to Portainer via API
run: |
# Get current service spec
SERVICE_URL="${{ secrets.PORTAINER_API }}/endpoints/2/docker/services/ascii-art-app_ascii-art-app"
SPEC=$(curl -sk "$SERVICE_URL" -H "Authorization: Bearer ${{ secrets.PORTAINER_TOKEN }}")
# Update version to force redeploy
VERSION=$(echo "$SPEC" | jq -r '.Version.Index')
UPDATED_SPEC=$(echo "$SPEC" | jq '.Spec | .TaskTemplate.ForceUpdate += 1')
# Redeploy
curl -sk -X POST "$SERVICE_URL/update?version=$VERSION" \
-H "Authorization: Bearer ${{ secrets.PORTAINER_TOKEN }}" \
-H "Content-Type: application/json" \
-d "$UPDATED_SPEC"