Skip to content

fix: validate files to be uploaded (#3872) #729

fix: validate files to be uploaded (#3872)

fix: validate files to be uploaded (#3872) #729

Workflow file for this run

name: Build seed containers
on:
push:
branches:
- main
- dsinghvi/fix-ir-jsons
workflow_dispatch:
# Cancel previous workflows on previous push
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DOCKER_BUILDKIT: 1
jobs:
changes:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
ts:
- 'docker/seed/Dockerfile.ts'
- '.github/workflows/seed-dockers.yml'
java:
- 'docker/seed/Dockerfile.java'
- '.github/workflows/seed-dockers.yml'
python:
- 'docker/seed/Dockerfile.python'
- '.github/workflows/seed-dockers.yml'
build-container:
if: ${{ needs.changes.outputs.packages != '' && toJSON(fromJSON(needs.changes.outputs.packages)) != '[]' }}
strategy:
matrix:
# Parse JSON array containing names of all filters matching any of changed files
# e.g. ['package1', 'package2'] if both package folders contains changes
package: ${{ fromJSON(needs.changes.outputs.packages) }}
runs-on: ubuntu-latest
needs: changes
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: fernapi/${{ matrix.package }}-seed
tags: |
type=sha
latest
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/seed/Dockerfile.${{ matrix.package }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=min
push: true
# use short SHA if modded, or just use latest if nothing changed
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}