Files
Pygentic-AI/.github/workflows/docker-image.yml
T
fsecada01 bad9a40bc3
Bandit / bandit (push) Canceled after 0s
Docker Image CI / build (3.13) (push) Canceled after 0s
Merge pull request #23 from FJS-Services-Inc/feat/adopt-shared-packages
Adopt shared fastapi-service-kit (db, logging, asyncio helpers)
2026-11-15 23:01:37 -05:00

66 lines
2.4 KiB
YAML

name: Docker Image CI
on:
pull_request:
branches: [ "*_deploy"]
push:
branches: [ "*_deploy", "feature_*", "main" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
max-parallel: 4
matrix:
python-version: [ "3.13" ]
steps:
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Sanitize branch name for Docker tag
shell: bash
run: echo "sanitized_branch=$(echo '${{ steps.extract_branch.outputs.branch }}' | sed 's/\//-/g')" >> $GITHUB_OUTPUT
id: sanitize_branch
- uses: actions/checkout@v4
with:
persist-credentials: false
# The image build fetches the PRIVATE fsecada01/shared-packages repo
# (git dependency), so it needs a short-lived GitHub App installation
# token with read-only contents access to that one repository.
# This repo is public: pull requests from forks do not receive
# secrets, so this step fails for them. The image build is only
# expected to run for same-repo branches.
- name: Create GitHub App token for shared-packages
id: app-token
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2
with:
app-id: ${{ secrets.SHARED_PACKAGES_APP_ID }}
private-key: ${{ secrets.SHARED_PACKAGES_APP_PRIVATE_KEY }}
owner: fsecada01
repositories: shared-packages
permission-contents: read
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Build the Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
s3docker.francissecada.com/pygentic_ai:${{ steps.sanitize_branch.outputs.sanitized_branch }}.${{ steps.date.outputs.date }}
s3docker.francissecada.com/pygentic_ai:${{ steps.sanitize_branch.outputs.sanitized_branch }}-latest
pull: true
secrets: |
gh_token=${{ steps.app-token.outputs.token }}