-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (94 loc) · 2.71 KB
/
ci.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: ci
on:
push:
branches:
- main
schedule:
- cron: "0 0 * * *"
jobs:
prepare:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
length: ${{ steps.matrix.outputs.length }}
steps:
- uses: actions/checkout@v4
name: Checkout
- id: matrix
name: Discover changed services
uses: developer-friendly/selective-builds-actions@v1
with:
redis-host: ${{ secrets.REDIS_HOST }}
redis-port: ${{ secrets.REDIS_PORT }}
redis-password: ${{ secrets.REDIS_PASSWORD }}
redis-ssl: ${{ secrets.REDIS_SSL }}
exclusions: |
.git
.github
build:
needs: prepare
runs-on: ubuntu-latest
if: needs.prepare.outputs.length > 0
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
- name: Pre-process image name
id: image-name
run: |
name=$(echo ${{ matrix.directory }} | sed 's/.*\///')
echo "name=$name" >> $GITHUB_OUTPUT
- id: meta
name: Docker metadata
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/${{ steps.image-name.outputs.name }}
- id: build-push
name: Build and push
uses: docker/build-push-action@v6
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: ${{ matrix.directory }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ steps.meta.outputs.tags }}
finalize:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
steps:
- uses: actions/checkout@v4
name: Checkout
- id: matrix
name: Discover changed services
uses: developer-friendly/selective-builds-actions@v1
with:
redis-host: ${{ secrets.REDIS_HOST }}
redis-port: ${{ secrets.REDIS_PORT }}
redis-password: ${{ secrets.REDIS_PASSWORD }}
redis-ssl: ${{ secrets.REDIS_SSL }}
mode: submit
exclusions: |
.git
.github