Feat/longform #48
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
push: | |
branches: [ "main" ] | |
tags: [ 'v*.*.*' ] | |
paths: | |
- 'podcastfy/**' | |
- 'setup.py' | |
- 'requirements.txt' | |
- 'Dockerfile' | |
- 'Dockerfile.dev' | |
- '.github/workflows/docker-publish.yml' | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- 'podcastfy/**' | |
- 'setup.py' | |
- 'requirements.txt' | |
- 'Dockerfile' | |
- 'Dockerfile.dev' | |
- '.github/workflows/docker-publish.yml' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Build and push PyPI version with caching | |
- name: Build and push PyPI Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha,scope=prod | |
cache-to: type=gha,scope=prod,mode=max | |
# Build and push development version with caching | |
- name: Build and push development Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile.dev | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha,scope=dev | |
cache-to: type=gha,scope=dev,mode=max | |
- name: Test Docker images | |
env: | |
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: | | |
# Test PyPI version | |
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest python3 -c "import podcastfy" | |
# Test development version | |
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev | |
docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev python3 -c "import podcastfy" |