-
Notifications
You must be signed in to change notification settings - Fork 158
74 lines (68 loc) · 2.16 KB
/
build-seed.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Build seed containers
on:
push:
branches:
- main
workflow_dispatch:
# Cancel previous workflows on previous push
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
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: |
python:
- 'docker/seed/Dockerfile.python'
- 'generators/python/poetry.lock'
- '.github/workflows/build-seed.yml'
ts:
- 'docker/seed/Dockerfile.ts'
- '.github/workflows/build-seed.yml'
java:
- 'docker/seed/Dockerfile.java'
- '.github/workflows/build-seed.yml'
build-container:
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@v1
- 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@v2
with:
context: .
file: ./docker/seed/Dockerfile.${{ matrix.package }}
push: true
# use short SHA if modded, or just use latest if nothing changed
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}