-
Notifications
You must be signed in to change notification settings - Fork 8
59 lines (50 loc) · 1.65 KB
/
scheduled.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
name: Scheduled Container Image Packages
on:
schedule:
- cron: '0 9 * * MON'
workflow_dispatch:
jobs:
list-dockerfiles:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.dockerfiles.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- id: dockerfiles
run: echo "matrix=$(ls dockerfiles/ | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
ghcr:
runs-on: ubuntu-latest
needs: list-dockerfiles
permissions:
contents: read
packages: write
strategy:
matrix:
image: ${{ fromJson(needs.list-dockerfiles.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU for cross-platform builds
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: image-tag # example output: "ghcr.io/kestra-io/pydata:latest"
run: |
IMAGE=$(basename ${{ matrix.image }} .Dockerfile)
echo "image_url=ghcr.io/kestra-io/$IMAGE:latest" >> $GITHUB_OUTPUT
echo "file=dockerfiles/${{ matrix.image }}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.image-tag.outputs.image_url }}
file: ${{ steps.image-tag.outputs.file }}
platforms: linux/amd64,linux/arm64