Skip to content

feat(payments): draft GoPay provider alongside Stripe (#442) #172

feat(payments): draft GoPay provider alongside Stripe (#442)

feat(payments): draft GoPay provider alongside Stripe (#442) #172

name: Media pipeline Docker
permissions:
contents: read
packages: write
on:
push:
branches:
- main
paths:
- 'packages/media-pipeline/**'
- 'packages/storage/**'
- 'package.json'
- 'package-lock.json'
- '.dockerignore'
- '.github/workflows/media-pipeline-docker.yml'
- '.github/scripts/media-pipeline-docker-should-build.sh'
pull_request:
paths:
- 'packages/media-pipeline/**'
- 'packages/storage/**'
- 'package.json'
- 'package-lock.json'
- '.dockerignore'
- '.github/workflows/media-pipeline-docker.yml'
- '.github/scripts/media-pipeline-docker-should-build.sh'
workflow_dispatch:
concurrency:
group: media-pipeline-docker-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/vmp-media-pipeline
jobs:
changes:
runs-on: ubuntu-latest
outputs:
should-build: ${{ steps.detect.outputs.should-build }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Detect media-pipeline Docker rebuild requirement
id: detect
shell: bash
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "should-build=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
else
BASE="${{ github.event.before }}"
HEAD="${{ github.sha }}"
fi
SHOULD_BUILD="$(bash .github/scripts/media-pipeline-docker-should-build.sh "$BASE" "$HEAD")"
echo "should-build=$SHOULD_BUILD" >> "$GITHUB_OUTPUT"
if [ "$SHOULD_BUILD" = "true" ]; then
echo "Media-pipeline Docker image rebuild required."
else
echo "Skipping Docker build — lockfile/root changes do not affect media-pipeline or storage."
fi
build:
needs: changes
if: needs.changes.outputs.should-build == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha,prefix=
type=ref,event=branch
type=ref,event=pr
- uses: docker/build-push-action@v6
with:
context: .
file: packages/media-pipeline/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max