Files
ascii-art-app/.gitea/workflows/deploy.yml
T
rmancinasandClaude Opus 5.5 8dc6a973ce
Build and Deploy / Build Image (push) Successful in 32s
Build and Deploy / Deploy (push) Successful in 6s
feat: /version endpoint; fix deploy action inputs
- Bake the commit SHA into the image (GIT_SHA build arg) and serve it at
  /version, so a deploy can be verified end to end. This repo is the
  dockerloid deploy test service.
- cssnr/portainer-stack-deploy-action@v1 reads `endpoint` and `pull`;
  `endpoint_id` / `pull_image` were silently ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 15:09:37 -07:00

79 lines
2.1 KiB
YAML

name: Build and Deploy
on:
push:
branches: [main]
paths:
- "**"
- "Dockerfile"
- "docker-compose.yml"
- ".gitea/workflows/**"
workflow_dispatch:
env:
REGISTRY: git.mancinas.io
jobs:
build:
name: Build Image
runs-on: docker
container:
image: docker:27-dind
options: --privileged
permissions:
contents: read
packages: write
steps:
- name: Install Node.js for actions
run: apk add --no-cache nodejs npm
- name: Checkout code
uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/ascii-art-app
tags: |
type=ref,event=branch
type=raw,value=latest,enable={{is_default_branch}}
- uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
build-args: |
GIT_SHA=${{ github.sha }}
deploy:
name: Deploy
needs: [build]
runs-on: docker
container:
image: node:18-alpine
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
steps:
- uses: actions/checkout@v4
- uses: cssnr/portainer-stack-deploy-action@v1
with:
url: ${{ secrets.PORTAINER_URL }}
token: ${{ secrets.PORTAINER_API_KEY }}
name: ${{ secrets.PORTAINER_STACK_NAME }}
file: docker-compose.yml
type: file
pull: true
endpoint: ${{ secrets.PORTAINER_ENDPOINT_ID }}
env_data: |
{
"IMAGE": "${{ env.REGISTRY }}/${{ github.repository_owner }}/ascii-art-app:latest"
}