-
-
Notifications
You must be signed in to change notification settings - Fork 2
79 lines (77 loc) · 2.26 KB
/
build-on-commit.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
75
76
77
78
79
name: build-on-commit
on:
push:
branches:
- master
jobs:
base:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: >
cd base-images &&
docker buildx build --push
--file Dockerfile.${{ matrix.name }}
--platform linux/amd64,linux/arm64
--build-arg REPO=${GITHUB_REPOSITORY,,}
--tag ghcr.io/${GITHUB_REPOSITORY,,}:${{ matrix.name }} .
strategy:
matrix:
include:
- name: alpine-320
- name: alpine-edge
- name: debian-bookworm
- name: debian-sid
- name: ubuntu-jammy
- name: ubuntu-noble
meta:
name: Ingest Metadata
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-meta.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-meta
run: |
curl -o yq -L "https://github.com/mikefarah/yq/releases/download/v4.43.1/yq_linux_amd64"
chmod +x yq
echo "matrix=$(./yq -o=j -I=0 '.' metadata/metadata.yml)" >> $GITHUB_OUTPUT
build:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
needs:
- base
- meta
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
folder:
- "apps/${{ matrix.name }}/**"
- if: steps.changes.outputs.folder == 'true'
run: >
cd apps/${{ matrix.name }}/ &&
docker buildx build --push
--platform ${{ matrix.arch }}
--build-arg REPO=${GITHUB_REPOSITORY,,}
--tag ghcr.io/${GITHUB_REPOSITORY,,}:${{ matrix.name }} .
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.meta.outputs.matrix) }}